Exemple #1
0
 def status(self, name):
     index, instance = self.find_instance(name)
     if index < 0:
         raise storage.InstanceNotFoundError()
     return instance.state
Exemple #2
0
 def info(self, name):
     index, instance = self.find_instance(name)
     if index < 0:
         raise storage.InstanceNotFoundError()
     return {"name": instance.name, "secret": "wat"}
Exemple #3
0
 def remove_instance(self, name):
     index, _ = self.find_instance(name)
     if index == -1:
         raise storage.InstanceNotFoundError()
     del self.instances[index]
Exemple #4
0
 def unbind(self, name, app_host):
     index, instance = self.find_instance(name)
     if index < 0:
         raise storage.InstanceNotFoundError()
     instance.unbind(app_host)
Exemple #5
0
 def test_status_instance_not_found_in_storage(self):
     storage = mock.Mock()
     storage.retrieve_instance.side_effect = api_storage.InstanceNotFoundError()
     manager = managers.BaseManager(storage)
     with self.assertRaises(api_storage.InstanceNotFoundError):
         manager.status("secret")
Exemple #6
0
 def test_new_instance(self):
     storage = mock.Mock()
     storage.retrieve_instance.side_effect = api_storage.InstanceNotFoundError()
     manager = managers.BaseManager(storage)
     instance = manager.new_instance("someapp")
     storage.store_instance.assert_called_with(instance)