def test_post(self): stork.Api('path1').resource('path2').post() stork.Resource.client.request.assert_called_with('post', url='path1/path2', params=None, data=None, headers={}, cookies=None, timeout=None, auth=None, verify=None, allow_redirects=None)
def test_default_header_overriden(self): api = stork.Api('http://myapi/v1', headers={'accept-language': 'es'}) api.resource('path').get(headers={'accept-language': 'en'}) stork.Resource.client.request.assert_called_with( 'get', url='http://myapi/v1/path', params=None, data=None, headers={'accept-language': 'en'}, cookies=None, timeout=None, auth=None, verify=None, allow_redirects=None)
def test_resource(self): api = stork.Api('http://myapi/v1') resource = api.resource('path') assert 'http://myapi/v1/path' == resource.path
def test_nested_resource_slash_end(self): r = stork.Api('path1/').resource('path2') assert r.path == 'path1/path2'
def test_nested_resource_slash_beginning(self): r = stork.Api('path1').resource('/path2') assert r.path == 'path1/path2'