Story #436: As a user I can remove an object from swift.

This commit is contained in:
Matt Butcher
2012-01-05 11:51:52 -06:00
parent c104af1f3a
commit fea7daa8a2
2 changed files with 8 additions and 0 deletions

View File

@@ -260,11 +260,16 @@ class Container implements \Countable {
$client = \HPCloud\Transport::instance();
try {
print $url;
$response = $client->doRequest($url, 'DELETE', $headers);
}
catch (\HPCloud\Transport\FileNotFoundException $fnfe) {
return FALSE;
}
catch (\HPCloud\Transport\MethodNotAllowedException $e) {
$e->setMessage('DELETE ' . $url);
throw $e;
}
if ($response->status() != 204) {
throw new \HPCloud\Exception("An unknown exception occured while deleting $name.");

View File

@@ -113,8 +113,11 @@ class ContainerTest extends \HPCloud\Tests\TestCase {
$ret = $container->delete(self::FNAME);
$fail = $container->delete('no_such_file.txt');
$this->destroyContainerFixture();
$this->assertTrue($ret);
$this->assertFalse($fail);
}