def test_get_data_set_by_name(self, mock_request): mock_request.__name__ = 'request' api = AdminAPI('http://admin.api', None) api.get_data_set_by_name('foo_bar') mock_request.assert_called_with( 'GET', 'http://admin.api/data-sets/foo_bar', headers=match_equality(has_entries({ 'Accept': 'application/json', })), data=None, )
def test_get_data_set_by_name(self, mock_request): mock_request.__name__ = 'request' api = AdminAPI('http://admin.api', None) api.get_data_set_by_name('foo_bar') mock_request.assert_called_with( method='GET', url='http://admin.api/data-sets/foo_bar', headers=match_equality( has_entries({ 'Accept': 'application/json', })), data=mock.ANY, params=None, )
def test_get_data_set_by_name_should_return_None_on_404( self, mock_request): response = Response() response.status_code = 404 mock_request.return_value = response mock_request.__name__ = 'get' api = AdminAPI('http://admin.api', 'token') data_set = api.get_data_set_by_name('foo_bar') eq_(data_set, None)
def test_get_data_set_by_name_should_return_None_on_404( self, mock_request): response = Response() response.status_code = 404 mock_request.return_value = response mock_request.__name__ = 'get' api = AdminAPI('http://admin.api', 'token') data_set = api.get_data_set_by_name('foo_bar') eq_(data_set, None)