[Bps-public-commit] SD branch, master, updated. 1efca95c0c85cb96785ee7ece8155e31b4c76424

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Jun 12 03:36:31 EDT 2009


The branch, master has been updated
       via  1efca95c0c85cb96785ee7ece8155e31b4c76424 (commit)
      from  b33f2f20ac6f7db5d3568d74ed0f6baf435e15c8 (commit)

Summary of changes:
 t/sd-gcode/basic.t  |   70 +++++++++++++++++++++++++++++++++++++++++++++++++++
 t/sd-github/basic.t |   61 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 131 insertions(+), 0 deletions(-)
 create mode 100644 t/sd-gcode/basic.t
 create mode 100644 t/sd-github/basic.t

- Log -----------------------------------------------------------------
commit 1efca95c0c85cb96785ee7ece8155e31b4c76424
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 12 15:36:23 2009 +0800

    add basic tests for gcode and github

diff --git a/t/sd-gcode/basic.t b/t/sd-gcode/basic.t
new file mode 100644
index 0000000..b6a0c62
--- /dev/null
+++ b/t/sd-gcode/basic.t
@@ -0,0 +1,70 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Prophet::Test;
+use Path::Class;
+plan tests => 8;
+use App::SD::Test;
+
+BEGIN {
+    require File::Temp;
+    $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'}
+        = File::Temp::tempdir( CLEANUP => 1 ) . '/_svb';
+    diag "export SD_REPO=" . $ENV{'PROPHET_REPO'} . "\n";
+}
+
+my $sd_gcode_url = "gcode:net-google-code";
+
+my ( $ret, $out, $err );
+( $ret, $out, $err ) =
+  run_script( 'sd', [ 'clone', '--from', $sd_gcode_url ] );
+my $for_sd_id;
+
+diag($err) if ($err);
+run_output_matches(
+    'sd',
+    [ 'ticket', 'list', '--regex', 'for sd test' ],
+    [qr/(.*?)(?{ $for_sd_id = $1 }) for sd test accepted/]
+);
+
+( $ret, $out, $err ) =
+  run_script( 'sd', [ 'ticket', 'comments', $for_sd_id ] );
+diag($err) if ($err);
+
+like( $out, qr/first comment.*second comment/s, 'comments pulled' );
+
+( $ret, $out, $err ) = run_script( 'sd', [ 'attachment', 'list' ] );
+diag($err) if ($err);
+my ( $att_id ) = $out =~ /(\d+)\s*foo.txt/;
+ok( $att_id, 'attachments pulled' );
+( $ret, $out, $err ) = run_script( 'sd', [ 'attachment', 'content', $att_id ] );
+diag($err) if ($err);
+like( $out, qr/foobar/, 'attachment content' );
+
+( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_gcode_url ] );
+diag($err) if ($err);
+
+run_script( 'sd', [ 'ticket', 'comment', $for_sd_id, '-m', 'comment from sd' ] );
+
+my $yatta_id;
+run_output_matches(
+    'sd',
+    [ 'ticket', 'create', '--', '--summary', 'YATTA', '--status', 'new' ],
+    [qr/Created ticket (\d+)(?{ $yatta_id = $1 })/]
+);
+
+run_output_matches(
+    'sd',
+    [ 'ticket', 'list', '--regex', 'YATTA' ],
+    [qr/(.*?)(?{ $yatta_id = $1 }) YATTA new/]
+);
+
+( $ret, $out, $err ) =
+  run_script( 'sd', [ 'push', '--to', $sd_gcode_url, '--dry-run' ] );
+diag($err) if ($err);
+diag($out);
+
+like( $out, qr/"content" set to "comment from sd"/, 'comment pushed' );
+like( $out, qr/"summary" set to "YATTA"/, 'ticket yatta pushed' );
+
diff --git a/t/sd-github/basic.t b/t/sd-github/basic.t
new file mode 100644
index 0000000..3363066
--- /dev/null
+++ b/t/sd-github/basic.t
@@ -0,0 +1,61 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+use Prophet::Test;
+use Path::Class;
+plan tests => 6;
+use App::SD::Test;
+
+BEGIN {
+    require File::Temp;
+    $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'}
+        = File::Temp::tempdir( CLEANUP => 1 ) . '/_svb';
+    diag "export SD_REPO=" . $ENV{'PROPHET_REPO'} . "\n";
+}
+
+my $url           = 'http://root:password@github.com|fayland|perl-net-github|';
+my $sd_github_url = "github:$url";
+
+my ( $ret, $out, $err );
+( $ret, $out, $err ) =
+  run_script( 'sd', [ 'clone', '--from', $sd_github_url ] );
+my $first_id;
+
+diag($err) if ($err);
+run_output_matches(
+    'sd',
+    [ 'ticket', 'list', '--regex', 'test for sd' ],
+    [qr/(.*?)(?{ $first_id = $1 }) test for sd/]
+);
+
+( $ret, $out, $err ) =
+  run_script( 'sd', [ 'ticket', 'comments', $first_id ] );
+like( $out, qr/first comment.*second comment/s, 'comments pulled' );
+
+( $ret, $out, $err ) = run_script( 'sd', [ 'pull', '--from', $sd_github_url ] );
+diag($err);
+
+run_script( 'sd', [ 'ticket', 'comment', $first_id, '-m', 'comment from sd' ] );
+
+my $yatta_id;
+run_output_matches(
+    'sd',
+    [ 'ticket', 'create', '--', '--summary', 'YATTA', '--status', 'open' ],
+    [qr/Created ticket (\d+)(?{ $yatta_id = $1 })/]
+);
+
+run_output_matches(
+    'sd',
+    [ 'ticket', 'list', '--regex', 'YATTA' ],
+    [qr/(.*?)(?{ $yatta_id = $1 }) YATTA open/]
+);
+
+( $ret, $out, $err ) =
+  run_script( 'sd', [ 'push', '--to', $sd_github_url, '--dry-run' ] );
+diag($out);
+diag($err);
+
+like( $out, qr/"content" set to "comment from sd"/, 'comment pushed' );
+like( $out, qr/"summary" set to "YATTA"/, 'ticket yatta pushed' );
+

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list