geolocate.tests package

Submodules

geolocate.tests.console_mocks module

console_mocks.py

Programmed by: Dante Signal31

email: dante.signal31@gmail.com

class geolocate.tests.console_mocks.MockedConsoleOutput[source]

Bases: object

Context manager to catch console output.

output()[source]
Returns:Console output.
Return type:str
static reset()[source]

Reinit output buffer.

Returns:None

geolocate.tests.test_config module

test_config.py

Programmed by: Dante Signal31

email: dante.signal31@gmail.com

class geolocate.tests.test_config.TestConfiguration(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_config_OpenConfigurationToUpdate()[source]
test_config_get_disabled_locators_preference()[source]
test_config_reset_locators_preference()[source]
test_config_set_locators_preference()[source]
test_config_set_locators_preference_error()[source]
test_configuration_equality()[source]
test_database_folder_validation()[source]
test_download_url_validation()[source]
test_get_config_path()[source]
test_get_properties()[source]
test_license_key_validation()[source]
test_load_configuration_config_not_found()[source]
test_load_configuration_create_default_config_file()[source]
test_read_config_file_config_not_found()[source]
test_save_configuration()[source]
test_update_interval_validation()[source]
test_user_id_validation()[source]

geolocate.tests.test_geolocate module

test_geolocate.py

Programmed by: Dante Signal31

email: dante.signal31@gmail.com

class geolocate.tests.test_geolocate.Arguments(show_enabled_locators, set_locators_preference, show_disabled_locators, reset_locators_preference, set_user, set_password)

Bases: tuple

reset_locators_preference

Alias for field number 3

set_locators_preference

Alias for field number 1

set_password

Alias for field number 5

set_user

Alias for field number 4

show_disabled_locators

Alias for field number 2

show_enabled_locators

Alias for field number 0

class geolocate.tests.test_geolocate.ErroneousArguments(show_enabled_locators, set_locators_preference, show_disabled_locators, reset_locators_preference, erroneous_argument)

Bases: tuple

erroneous_argument

Alias for field number 4

reset_locators_preference

Alias for field number 3

set_locators_preference

Alias for field number 1

show_disabled_locators

Alias for field number 2

show_enabled_locators

Alias for field number 0

class geolocate.tests.test_geolocate.MockedArguments(arg1, arg2, arg3, arg4)[source]

Bases: object

Used to detect private attributes.

I couldn’t use namedtuple because it doesn’t admit attributes prefixed by “_”.

class geolocate.tests.test_geolocate.TestGeoLocate(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_get_user_attributes()[source]
test_process_optional_parameters_reset_locators_preference()[source]
test_process_optional_parameters_set_locators_preference()[source]
test_process_optional_parameters_show_disabled_locators()[source]
test_process_optional_parameters_show_enabled_locators()[source]
test_reset_locators_preference()[source]
test_set_locators_preference()[source]
test_set_password()[source]
test_set_user()[source]
test_show_disabled_locators()[source]
test_show_enabled_locators()[source]
test_show_password()[source]
test_show_user()[source]
tests_process_optional_parameters_erroneos_argument()[source]

geolocate.tests.test_geowrapper module

test_geowrapper.py

Programmed by: Dante Signal31

email: dante.signal31@gmail.com

class geolocate.tests.test_geowrapper.TestGeoWrapper(methodName='runTest')[source]

Bases: unittest.case.TestCase

test_decompress_file()[source]
test_find_compressed_file()[source]
test_geoip_database_add_locators_default_configuration()[source]
test_geoip_database_add_locators_non_default_configuration()[source]
test_geoip_database_locate()[source]
test_get_new_database_path_name_find_file()[source]
test_get_uncompressed_file_name_path()[source]
test_local_database_geo_locator_creation()[source]
test_local_database_geo_locator_download_file()[source]
test_local_database_get_modification_time_failed()[source]
test_local_database_invalid()[source]
test_local_database_locate()[source]
test_local_database_not_found()[source]
test_local_database_too_old()[source]
test_local_database_too_old_local_database_not_found()[source]
test_local_database_update()[source]
test_print_compressed_file_not_found_error()[source]
test_web_service_geo_locator_creation()[source]
test_web_service_geo_locator_failed_creation()[source]

geolocate.tests.test_parser module

test_logparser.py

Programmed by: Dante Signal31

email: dante.signal31@gmail.com

class geolocate.tests.test_parser.TestInputReader(methodName='runTest')[source]

Bases: unittest.case.TestCase

classmethod setUpClass()[source]
classmethod tearDownClass()[source]
test_InputReader()[source]

Inject text in stdin and compare what is read from there to check it is the same.

class geolocate.tests.test_parser.TestParser(methodName='runTest')[source]

Bases: unittest.case.TestCase

static setUpClass()[source]
static tearDownClass()[source]
test_GeolocateInputParser_format_location_string()[source]

Check format_location_string() returns an string correctly formatted for every verbosity level.

test_GeolocateInputParser_locate()[source]

Check locate() returns an string correctly formatted for every verbosity level.

test_GeolocateInputParser_next_stdin()[source]

Check class is able to analyze input line by line and return lines with geodata strings included.

test_GeolocateInputParser_next_text()[source]

Check class is able to analyze a text and return it with geodata strings included.

test_find_ips_in_text()[source]

Check all embedded IP addresses are found.

test_find_unknowns()[source]

Check unknowns attributes are correctly translated to informational strings.

test_get_lines()[source]

Check text lines are correctly retrieved.

test_include_location_in_line()[source]

Check IP addresses are properly replaced with geodata string.

geolocate.tests.test_parser.city_response

alias of city

geolocate.tests.test_parser.continent_response

alias of continent

geolocate.tests.test_parser.country_response

alias of country

class geolocate.tests.test_parser.locate_response(continent, country, city, location)

Bases: tuple

city

Alias for field number 2

continent

Alias for field number 0

country

Alias for field number 1

location

Alias for field number 3

geolocate.tests.test_parser.location_response

alias of location

geolocate.tests.testing_tools module

testing_tools.py

Programmed by: Dante Signal31

email: dante.signal31@gmail.com

class geolocate.tests.testing_tools.OriginalFileSaved(original_file_path)[source]

Bases: object

Context manager to store original files in a safe place for tests and restore it after them.

class geolocate.tests.testing_tools.WorkingDirectoryChanged(new_working_dir)[source]

Bases: object

Sometimes unit test executes at a different path level than usual execution code. This context manager restores normal working directory after context manager exit.

Module contents