def test_namespace_set_before_start(self): """ Test namespace_set action without start """ with pytest.raises(StateCheckError, message='namespace_set action should raise an error if zerodb is not started'): zdb = Zerodb('zdb', data=self.valid_data) zdb.namespace_set('namespace', 'size', 12)
def test_namespace_set_namespace_doesnt_exist(self): """ Test namespace_set action if namespace doesn't exist """ with pytest.raises(LookupError, message='namespace_set action should raise an error if namespace doesn\'t exists'): zdb = Zerodb('zdb', data=self.valid_data) zdb.state.set('status', 'running', 'ok') zdb._namespace_exists_update_delete = MagicMock(return_value=False) zdb.namespace_set('namespace', 'size', 12)
def test_namespace_set(self): """ Test namespace_set action """ zdb = Zerodb('zdb', data=self.valid_data) zdb.state.set('status', 'running', 'ok') zdb._namespace_exists_update_delete = MagicMock(return_value=True) zdb._deploy = MagicMock() zdb.namespace_set('namespace', 'size', 12) zdb._zerodb_sal.deploy.assert_called_once_with()
def test_namespace_set(self): """ Test namespace_set action """ zdb = Zerodb('zdb', data=self.valid_data) zdb.state.set('actions', 'start', 'ok') zdb.api.services.get = MagicMock() zdb.namespace_set('namespace', 'maxsize', 12) zdb._zerodb_sal.set_namespace_property.assert_called_once_with( 'namespace', 'maxsize', 12)