def test_ns_unresolved(mocker, apiinfo_factory, nsinfo_factory): mocker.patch( 'cnct.client.fluent.parse', return_value=apiinfo_factory(namespaces=[nsinfo_factory(name='namespace')]), ) c = ConnectClient('Api Key') with pytest.raises(NotFoundError) as cv: c.ns('invalid') assert str(cv.value) == 'The namespace invalid does not exist.'
def test_ns(mocker): mocker.patch( 'cnct.client.fluent.parse', return_value=None, ) c = ConnectClient('Api Key') assert isinstance(c.ns('namespace'), NS)
def test_ns_invalid_value(): c = ConnectClient('Api Key', specs_location=None) with pytest.raises(ValueError): c.ns('')
def test_ns_invalid_type(): c = ConnectClient('Api Key', specs_location=None) with pytest.raises(TypeError): c.ns(c)