tests.test_config

Unit tests for nailgun.config.

class tests.test_config.BaseServerConfigTestCase(methodName='runTest')

Tests for nailgun.config.BaseServerConfig.

test_delete()

Test nailgun.config.BaseServerConfig.delete().

Assert that the method reads the config file before writing, and that it writes out a correct config file.

test_get()

Test nailgun.config.BaseServerConfig.get().

Assert that the method extracts the asked-for section from a configuration file and correctly populates a new BaseServerConfig object. Also assert that the auth attribute is a list. (See the docstring for nailgun.config.ServerConfig.get().)

test_get_labels()

Test nailgun.config.BaseServerConfig.get_labels().

Assert that the method returns the correct labels.

test_init()

Test instantiating nailgun.config.BaseServerConfig.

Assert that only provided values become object attributes.

test_init_invalid()

Test instantiating :class: nailgun.config.BaseServerConfig. Assert that configs with invalid versions do not load.

test_save()

Test nailgun.config.BaseServerConfig.save().

Assert that the method reads the config file before writing, and that it writes out a correct config file.

class tests.test_config.ReprTestCase(methodName='runTest')

Test method nailgun.config.BaseServerConfig.__repr__.

test_bsc_v1()

Test nailgun.config.BaseServerConfig.

Assert that __repr__ works correctly when url is specified.

test_bsc_v2()

Test nailgun.config.BaseServerConfig.

Assert that __repr__ works correctly when url and auth are specified.

test_bsc_v3()

Test nailgun.config.BaseServerConfig.

Assert that __repr__ works correctly when url and version are specified.

test_sc_v1()

Test nailgun.config.ServerConfig.

Assert that __repr__ works correctly when only a URL is passed in.

test_sc_v2()

Test nailgun.config.ServerConfig.

Assert that __repr__ works correctly when url and auth are specified.

test_sc_v3()

Test nailgun.config.ServerConfig.

Assert that __repr__ works correctly when url and version are specified.

test_sc_v4()

Test nailgun.config.ServerConfig.

Assert that __repr__ works correctly when url and verify are specified.

class tests.test_config.ServerConfigTestCase(methodName='runTest')

Tests for nailgun.config.ServerConfig.

test_get()

Test nailgun.config.ServerConfig.get().

Assert that the auth attribute is a tuple.

test_get_client_kwargs()

Test nailgun.config.ServerConfig.get_client_kwargs().

Assert that:

  • get_client_kwargs returns all of the instance attributes from its object except the “url” attribute, and
  • no instance attributes from the object are removed.
test_init()

Test instantiating nailgun.config.ServerConfig.

Assert that only provided values become object attributes.

test_raise_config_file_error()

Should raise error if path not found