def test_download(self): key = "test/baz" expected_contents = "test content" expected_output = '/tmp/builder/baz' s3.write(key, expected_contents) s3.download(key, expected_output) self.assertTrue(os.path.exists(expected_output)) self.assertEqual(open(expected_output, 'r').read(), expected_contents)
def test_download(self): key = "%s/foo" % self.prefix expected_contents = "test content" expected_output = '%s/baz' % self.local_path s3.write(key, expected_contents) s3.download(key, expected_output) self.assertTrue(os.path.exists(expected_output)) self.assertEqual(open(expected_output, 'r').read(), expected_contents)
def test_list(self): keys = [ "test/foo", "test/bar", "test/baz" ] for key in keys: s3.write(key, 'asdf') self.assertEqual(sorted(keys), sorted(s3.simple_listing("test/")))
def test_list(self): keys = [ "%s/foo-%s" % (self.prefix, base.generate_environment_name()), "%s/bar-%s" % (self.prefix, base.generate_environment_name()), "%s/baz-%s" % (self.prefix, base.generate_environment_name()), ] for key in keys: s3.write(key, 'asdf') list_result = sorted(s3.simple_listing("%s/" % self.prefix)) for key in keys: self.assertIn(key, list_result)
def test_list(self): keys = ["test/foo", "test/bar", "test/baz"] for key in keys: s3.write(key, 'asdf') self.assertEqual(sorted(keys), sorted(s3.simple_listing("test/")))
def test_delete(self): key = "test/foo" s3.write(key, "asdf") self.assertTrue(s3.exists(key)) s3.delete(key) self.assertFalse(s3.exists(key))
def test_overwrite(self): key = "test/foo" self.assertFalse(s3.exists(key)) s3.write(key, "asdf") self.assertRaises(KeyError, s3.write, key, "fdsa") s3.write(key, "fdsa", overwrite=True)
def test_delete(self): key = "%s/foo" % self.prefix s3.write(key, "asdf") self.assertTrue(s3.exists(key)) s3.delete(key) self.assertFalse(s3.exists(key))
def test_overwrite(self): key = "%s/foo" % self.prefix self.assertFalse(s3.exists(key)) s3.write(key, "asdf") self.assertRaises(KeyError, s3.write, key, "fdsa") s3.write(key, "fdsa", overwrite=True)