Mailing List Archive

[svn] r895 - in RT-Client: . lib/RT lib/RT/Client t
Author: autrijus
Date: Fri May 14 13:57:26 2004
New Revision: 895

Modified:
RT-Client/ (props changed)
RT-Client/lib/RT/Client.pm
RT-Client/lib/RT/Client/Container.pm
RT-Client/t/1-procedural.t
Log:
----------------------------------------------------------------------
r4882@not: autrijus | 2004-05-14T17:57:27.640024Z

* Add descriptions for all tests.
* Avoid testing for specific status code.
----------------------------------------------------------------------


Modified: RT-Client/lib/RT/Client.pm
==============================================================================
--- RT-Client/lib/RT/Client.pm (original)
+++ RT-Client/lib/RT/Client.pm Fri May 14 13:57:26 2004
@@ -97,7 +97,7 @@
stub 'search';

sub get {
- my $res = $self->_request(@_, method => 'OPTIONS'); # XXX - ditch this asap
+ my $res = $self->_request(@_, method => 'GET'); # XXX - ditch this asap
$res = $self->_request(@_, method => 'GET') or return undef;
return $self->_spawn($res);
}

Modified: RT-Client/lib/RT/Client/Container.pm
==============================================================================
--- RT-Client/lib/RT/Client/Container.pm (original)
+++ RT-Client/lib/RT/Client/Container.pm Fri May 14 13:57:26 2004
@@ -22,7 +22,7 @@
$uri = $res->header('Location');
return $self->client->describe($res->header('Location')) if $uri;

- return 1 if $res->code == 204;
+ return 1 if $res->is_success;

$self->status(500);
$self->errstr($res->content);

Modified: RT-Client/t/1-procedural.t
==============================================================================
--- RT-Client/t/1-procedural.t (original)
+++ RT-Client/t/1-procedural.t Fri May 14 13:57:26 2004
@@ -2,7 +2,7 @@

use FindBin;
use lib "$FindBin::Bin/../lib";
-use Test::More 'no_plan'; #tests => 51;
+use Test::More tests => 62;

$SIG{__WARN__} = sub { use Carp; Carp::cluck(@_) };
$SIG{__DIE__} = sub { use Carp; Carp::confess(@_) };
@@ -92,7 +92,7 @@
my $cf = $rt->add("$queue_uri/CustomFields", Name => rand(), Type => 'SelectSingle');
isa_ok($cf, 'RT::Client::Object');
my $cf_uri = $cf->uri;
-isnt($cf_uri, undef, 'New CF has a URI: '.$cfv_uri);
+isnt($cf_uri, undef, 'New CF has a URI: '.$cf_uri);
my $cf_id = $rt->get("$cf_uri.Id");

$rt->add("$cf_uri/Values", Name => 'Value1', Description => 'Description1');
@@ -119,22 +119,22 @@

$rt->current_user('RT_System');
my $id = $rt->get("$uri.Id");
-is($rt->set("Tickets/$id.Subject", 'set by system'), 'set by system');
+is($rt->set("Tickets/$id.Subject", 'by system'), 'by system', 'set subject');
my $sys_id = $rt->get("Users/RT_System.Id");
is($rt->get("Tickets/$id/Transactions/*-1.Creator"), $sys_id, 'set by system');
$rt->current_user($rt->username);

# 2. Ability to Close a Ticket via an External Interface

-is($rt->set("$uri.Status", 'resolved'), 'resolved');
-is($rt->get("$uri.Status"), 'resolved');
-is($rt->set("$uri.Status", 'open'), 'open');
+is($rt->set("$uri.Status", 'resolved'), 'resolved', 'resolve a ticket');
+is($rt->get("$uri.Status"), 'resolved', 'ticket resolved');
+is($rt->set("$uri.Status", 'open'), 'open', 'ticket reopened');

# 2.1 Ability to close a ticket based on ticket number. We'd prefer to
# identify closing user as well if possible.

$rt->current_user('RT_System');
-is($rt->set("Tickets/$id.Status", 'resolved'), 'resolved');
+is($rt->set("Tickets/$id.Status", 'resolved'), 'resolved', 'resolve a ticket');
is($rt->get("Tickets/$id/Transactions/*-1.Creator"), $sys_id, 'set by system');
$rt->current_user($rt->username);

@@ -143,13 +143,13 @@
# 3.1 Error Responses: CLI must return status and error responses
# instead of end-user help text.

-is($rt->set("$uri.Status", 'open'), 'open');
-is($rt->status, 200);
-is($rt->set("$uri.Owner", 'no_such_user'.rand()), undef);
-is($rt->status, 400);
+is($rt->set("$uri.Status", 'open'), 'open', 'set ticket status to open');
+is($rt->status, 200, 'ticket opened with status 200');
+is($rt->set("$uri.Owner", 'nobody'.rand()), undef, 'set nonexistent owner');
+is($rt->status, 400, 'set ticket owner failed with status 400');
isnt($rt->errstr, undef, 'errstr is '.$rt->errstr);

# 3.2 Environment: Support perl 5.6.1.

-cmp_ok($], '>=', 5.006001);
+cmp_ok($], '>=', 5.006001, 'perl version >= 5.6.1');

_______________________________________________
Rt-commit mailing list
Rt-commit@lists.bestpractical.com
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit