Index: /trunk/Nebulous-Server/t/22_client_delete_instance.t
===================================================================
--- /trunk/Nebulous-Server/t/22_client_delete_instance.t	(revision 2882)
+++ /trunk/Nebulous-Server/t/22_client_delete_instance.t	(revision 2882)
@@ -0,0 +1,92 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 22_client_delete_instance.t,v 1.1 2005-01-04 03:14:19 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Apache::Test qw( -withtestmore );
+
+plan tests => 9;
+
+use lib qw( ./t ./lib );
+
+use PS::IPP::IData::Client;
+use PS::IPP::IData::Util qw( :standard );
+use Test::IData;
+
+my $hostport = Apache::Test->config->{ 'hostport' };
+
+Test::IData->setup;
+
+{
+    my $idata = PS::IPP::IData::Client->new(
+        proxy => "http://$hostport/idata",
+    );
+    $idata->create( "foo" );
+
+    my $locations = $idata->find_instances( "foo" );
+
+    my $uri = $idata->delete_instance( @$locations[0] );
+
+    is( $uri, @$locations[0], "delete instance" );
+
+    ok( ! -e _get_file_path( @$locations[0] ), "deleted file" );
+}
+
+Test::IData->setup;
+
+{
+    my $idata = PS::IPP::IData::Client->new(
+        proxy => "http://$hostport/idata",
+    );
+    $idata->create( "foo" );
+    $idata->replicate( "foo" );
+
+    my $uri1 = $idata->find_instances( "foo" )->[0];
+
+    ok( $idata->delete_instance( $uri1 ), "delete instance" );
+
+    my $uri2 = $idata->find_instances( "foo" )->[0];
+
+    isnt( $uri1, $uri2, "other instance remains" );
+
+    ok( $idata->delete_instance( $uri2 ), "delete instance" );
+
+    my $locations = $idata->find_instances( "foo" );
+
+    is( $locations, undef, "no remaning instances" );
+}
+
+{
+    my $idata = PS::IPP::IData::Client->new(
+        proxy => "http://$hostport/idata",
+    );
+    my $uri = $idata->delete_instance( "file:/foo" );
+
+    is( $uri, undef, "uri does not exist" );
+}
+
+Test::IData->setup;
+
+eval {
+    my $idata = PS::IPP::IData::Client->new(
+        proxy => "http://$hostport/idata",
+    );
+    $idata->delete_instance();
+};
+like( $@, qr/1 was expected/, "no params" );
+
+Test::IData->setup;
+
+eval {
+    my $idata = PS::IPP::IData::Client->new(
+        proxy => "http://$hostport/idata",
+    );
+    $idata->delete_instance( "foo", 2 );
+};
+like( $@, qr/1 was expected/, "too many params" );
+
+Test::IData->cleanup;
Index: /trunk/Nebulous/t/22_client_delete_instance.t
===================================================================
--- /trunk/Nebulous/t/22_client_delete_instance.t	(revision 2882)
+++ /trunk/Nebulous/t/22_client_delete_instance.t	(revision 2882)
@@ -0,0 +1,92 @@
+#!/usr/bin/perl
+
+# Copryight (C) 2004-2005  Joshua Hoblitt
+#
+# $Id: 22_client_delete_instance.t,v 1.1 2005-01-04 03:14:19 jhoblitt Exp $
+
+use strict;
+use warnings FATAL => qw( all );
+
+use Apache::Test qw( -withtestmore );
+
+plan tests => 9;
+
+use lib qw( ./t ./lib );
+
+use PS::IPP::IData::Client;
+use PS::IPP::IData::Util qw( :standard );
+use Test::IData;
+
+my $hostport = Apache::Test->config->{ 'hostport' };
+
+Test::IData->setup;
+
+{
+    my $idata = PS::IPP::IData::Client->new(
+        proxy => "http://$hostport/idata",
+    );
+    $idata->create( "foo" );
+
+    my $locations = $idata->find_instances( "foo" );
+
+    my $uri = $idata->delete_instance( @$locations[0] );
+
+    is( $uri, @$locations[0], "delete instance" );
+
+    ok( ! -e _get_file_path( @$locations[0] ), "deleted file" );
+}
+
+Test::IData->setup;
+
+{
+    my $idata = PS::IPP::IData::Client->new(
+        proxy => "http://$hostport/idata",
+    );
+    $idata->create( "foo" );
+    $idata->replicate( "foo" );
+
+    my $uri1 = $idata->find_instances( "foo" )->[0];
+
+    ok( $idata->delete_instance( $uri1 ), "delete instance" );
+
+    my $uri2 = $idata->find_instances( "foo" )->[0];
+
+    isnt( $uri1, $uri2, "other instance remains" );
+
+    ok( $idata->delete_instance( $uri2 ), "delete instance" );
+
+    my $locations = $idata->find_instances( "foo" );
+
+    is( $locations, undef, "no remaning instances" );
+}
+
+{
+    my $idata = PS::IPP::IData::Client->new(
+        proxy => "http://$hostport/idata",
+    );
+    my $uri = $idata->delete_instance( "file:/foo" );
+
+    is( $uri, undef, "uri does not exist" );
+}
+
+Test::IData->setup;
+
+eval {
+    my $idata = PS::IPP::IData::Client->new(
+        proxy => "http://$hostport/idata",
+    );
+    $idata->delete_instance();
+};
+like( $@, qr/1 was expected/, "no params" );
+
+Test::IData->setup;
+
+eval {
+    my $idata = PS::IPP::IData::Client->new(
+        proxy => "http://$hostport/idata",
+    );
+    $idata->delete_instance( "foo", 2 );
+};
+like( $@, qr/1 was expected/, "too many params" );
+
+Test::IData->cleanup;
