geolocate.tests package — Geolocate 1.3.0 documentation

# 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`

  Bases: `object`

  Context manager to catch console output.

  `output`()

    Returns: | Console output.
    Return type: | str

  static `reset`()

    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')

  Bases: `unittest.case.TestCase`

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

## 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)

  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')

  Bases: `unittest.case.TestCase`

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

## 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')

  Bases: `unittest.case.TestCase`

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

## 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')

  Bases: `unittest.case.TestCase`

  classmethod `setUpClass`()
  classmethod `tearDownClass`()
  `test_InputReader`()

    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')

  Bases: `unittest.case.TestCase`

  static `setUpClass`()
  static `tearDownClass`()
  `test_GeolocateInputParser_format_location_string`()

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

  `test_GeolocateInputParser_locate`()

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

  `test_GeolocateInputParser_next_stdin`()

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

  `test_GeolocateInputParser_next_text`()

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

  `test_find_ips_in_text`()

    Check all embedded IP addresses are found.

  `test_find_unknowns`()

    Check unknowns attributes are correctly translated to informational strings.

  `test_get_lines`()

    Check text lines are correctly retrieved.

  `test_include_location_in_line`()

    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)

  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)

  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