コード例 #1
0
ファイル: test_cf_client.py プロジェクト: piecommerce/pyrax
 def test_delete_objects_not_in_list(self):
     client = self.client
     client.connection.head_container = Mock()
     cont = client.get_container(self.cont_name)
     objs = [FakeStorageObject(client, cont, name="First"),
             FakeStorageObject(client, cont, name="Second")]
     cont.get_objects = Mock(return_value=objs)
     good_names = ["First", "Third"]
     client._local_files = good_names
     client.delete_object = Mock()
     client._delete_objects_not_in_list(cont)
     client.delete_object.assert_called_with(container=cont.name,
             name="Second")
コード例 #2
0
 def setUp(self):
     pyrax.connect_to_cloudservers = Mock()
     pyrax.connect_to_cloud_loadbalancers = Mock()
     pyrax.connect_to_cloud_databases = Mock()
     pyrax.connect_to_cloud_blockstorage = Mock()
     pyrax.identity = FakeIdentity()
     pyrax.set_credentials("fakeuser", "fakeapikey")
     pyrax.connect_to_cloudfiles()
     self.client = pyrax.cloudfiles
     self.client._container_cache = {}
     self.cont_name = utils.random_name()
     self.obj_name = utils.random_name()
     self.fake_object = FakeStorageObject(self.client, self.cont_name,
                                          self.obj_name)
コード例 #3
0
 def setUp(self):
     pyrax.connect_to_cloudservers = Mock()
     pyrax.connect_to_cloud_loadbalancers = Mock()
     pyrax.connect_to_cloud_databases = Mock()
     pyrax.connect_to_cloud_blockstorage = Mock()
     pyrax.connect_to_cloudfiles()
     self.client = pyrax.cloudfiles
     self.client.connection.head_container = Mock()
     self.cont_name = utils.random_name(ascii_only=True)
     self.container = self.client.get_container(self.cont_name)
     self.obj_name = utils.random_name(ascii_only=True)
     self.fake_object = FakeStorageObject(self.client, self.cont_name,
                                          self.obj_name)
     self.client._container_cache = {}
     self.container.object_cache = {}