def test_collection_unresolved(mocker, apiinfo_factory, colinfo_factory): mocker.patch( 'cnct.client.fluent.parse', return_value=apiinfo_factory(collections=[colinfo_factory('resources')]), ) c = ConnectClient('Api Key') with pytest.raises(NotFoundError) as cv: c.collection('invalid') assert str(cv.value) == 'The collection invalid does not exist.'
def test_collection(mocker): mocker.patch( 'cnct.client.fluent.parse', return_value=None, ) c = ConnectClient('Api Key') assert isinstance(c.collection('resources'), Collection)
def test_collection_invalid_value(): c = ConnectClient('Api Key', specs_location=None) with pytest.raises(ValueError): c.collection('')