tests.test_client

Unit tests for nailgun.client.

class tests.test_client.ClientTestCase(methodName='runTest')

Tests for functions in nailgun.client.

setUp()

Hook method for setting up the test fixture before exercising it.

test_client_request()

Test nailgun.client.request().

Make the same assertions as tests.test_client.ClientTestCase.test_clients().

test_clients()

Test all the wrappers except nailgun.client.request().

The following functions are tested:

Assert that:

  • The wrapper function passes the correct parameters to requests.
  • The wrapper function returns whatever requests returns.
test_identical_args()

Check that the wrapper functions have the correct signatures.

For example, nailgun.client.delete() should have the same signature as requests.delete.

class tests.test_client.ContentTypeIsJsonTestCase(methodName='runTest')

Tests for function _content_type_is_json.

test_false()

Assert True is returned when content-type is not JSON.

test_false_with_no_headers()

If no headers passed should return None

test_true()

Assert True is returned when content-type is JSON.

class tests.test_client.SetContentTypeTestCase(methodName='runTest')

Tests for function _set_content_type.

test_existing_value()

Assert that no content-type is provided if one is set.

test_files_in_kwargs()

Assert that no content-type is provided if files are given.

test_no_value()

Assert that a content-type is provided if none is set.