def test_config_file_is_missing(self):
     logger = MagicMock()
     logger.warning = Mock()
     ConfigReader._LOGGER = logger
     with self.assertRaises(Exception):
         self.config_reader = ConfigReader(self.MISSING_CONFIG)
         self.assertTrue(logger.warning.called)
 def test_get_full_configuration(self):
     self.config_reader = ConfigReader(self.VALID_CONFIG_FULL)
     self.assertEquals(self.VALID_REGION_STRING, self.config_reader.region)
     self.assertEquals(self.VALID_HOST_STRING, self.config_reader.host)
     self.assertFalse(self.config_reader.debug)
     self.assertEquals(self.VALID_PROXY_SERVER_NAME,
                       self.config_reader.proxy_server_name)
     self.assertEquals(self.VALID_PROXY_SERVER_PORT,
                       self.config_reader.proxy_server_port)
 def test_valid_config_with_proxy_server_port(self):
     self.config_reader = ConfigReader(
         self.VALID_CONFIG_WITH_PROXY_SERVER_PORT)
     self.assertEquals(self.VALID_PROXY_SERVER_PORT,
                       self.config_reader.proxy_server_port)
 def test_valid_config_with_proxy_server_name(self):
     self.config_reader = ConfigReader(
         self.VALID_CONFIG_WITH_PROXY_SERVER_NAME)
     self.assertEquals(self.VALID_PROXY_SERVER_NAME,
                       self.config_reader.proxy_server_name)
 def test_valid_config_with_debug_disabled(self):
     self.config_reader = ConfigReader(
         self.VALID_CONFIG_WITH_DEBUG_DISABLED)
     self.assertFalse(self.config_reader.debug)
 def test_valid_config_with_debug_enabled(self):
     self.config_reader = ConfigReader(self.VALID_CONFIG_WITH_DEBUG_ENABLED)
     self.assertTrue(self.config_reader.debug)
 def test_push_asg_true(self):
     self.config_reader = ConfigReader(self.VALID_PUSH_ASG_AND_CONSTANT)
     self.assertTrue(self.config_reader.push_asg)
 def test_default_configurations(self):
     self.config_reader = ConfigReader(self.VALID_CONFIG_WITHOUT_CREDS)
     self.assertFalse(self.config_reader.pass_through)
     self.assertFalse(self.config_reader.debug)
 def test_push_constant_false(self):
     self.config_reader = ConfigReader(self.VALID_CONFIG_FULL)
     self.assertFalse(self.config_reader.push_constant)
 def test_get_credentials_path_from_config(self):
     self.config_reader = ConfigReader(self.VALID_CONFIG_FULL)
     self.assertEquals("./test/config_files/valid_credentials_file",
                       self.config_reader.credentials_path)
 def test_config_reader_without_path(self):
     with self.assertRaises(TypeError):
         self.config_reader = ConfigReader()
 def test_strip_whitespaces_from_config_file(self):
     self.config_reader = ConfigReader(self.VALID_CONFIG_WITH_WHITE_SPACES)
     self.assertEquals(self.VALID_REGION_STRING, self.config_reader.region)
     self.assertEquals(self.VALID_HOST_STRING, self.config_reader.host)
 def test_get_configuration_without_credentials(self):
     self.config_reader = ConfigReader(self.VALID_CONFIG_WITHOUT_CREDS)
     self.assertFalse(self.config_reader.credentials_path)
     self.assertEquals(self.VALID_REGION_STRING, self.config_reader.region)
     self.assertEquals(self.VALID_HOST_STRING, self.config_reader.host)
 def test_valid_config_with_pass_through_enabled(self):
     self.config_reader = ConfigReader(
         self.VALID_CONFIG_WITH_PASS_THROUGH_ENABLED)
     self.assertTrue(self.config_reader.pass_through)
 def test_push_constant_true(self):
     self.config_reader = ConfigReader(self.VALID_PUSH_ASG_AND_CONSTANT)
     self.assertTrue(self.config_reader.push_constant)
     self.assertEquals("potato",
                       self.config_reader.constant_dimension_value)
 def test_valid_config_with_pass_through_disabled(self):
     self.config_reader = ConfigReader(
         self.VALID_CONFIG_WITH_PASS_THROUGH_DISABLED)
     self.assertFalse(self.config_reader.pass_through)
Пример #17
0
 def test_get_full_configuration(self):
     self.config_reader = ConfigReader(self.VALID_CONFIG_FULL)
     self.assertEquals(self.VALID_REGION_STRING, self.config_reader.region)
     self.assertEquals(self.VALID_HOST_STRING, self.config_reader.host)
     self.assertFalse(self.config_reader.debug)