def test_namespace_url_before_start(self): """ Test namespace_url action without start """ with pytest.raises(StateCheckError, message='namespace action should raise an error if zerodb is not started'): zdb = Zerodb('zdb', data=self.valid_data) zdb.namespace_url('namespace')
def test_namespace_url_doesnt_exist(self): """ Test namespace_url action without start """ with pytest.raises(LookupError, message='namespace action should raise an error if namespace doesnt exist'): zdb = Zerodb('zdb', data=self.valid_data) zdb.state.set('status', 'running', 'ok') zdb.namespace_url('namespace')
def test_namespace_url(self): """ Test namespace_url action """ self.valid_data['namespaces'].append({'name': 'namespace', 'size': 20, 'public': True, 'password': ''}) zdb = Zerodb('zdb', data=self.valid_data) zdb.state.set('status', 'running', 'ok') namespace = MagicMock(url='url') zdb_sal = MagicMock(namespaces={'namespace': namespace}) zdb._node_sal.primitives.from_dict.return_value = zdb_sal assert zdb.namespace_url('namespace') == 'url'