Esempio n. 1
0
def test_validate_environment(env_def, strict, expected, expected_logs, caplog,
                              runway_context):
    """Test validate_environment."""
    mock_module = MutableMap(name='test_module')
    caplog.set_level(logging.DEBUG, logger='runway')
    assert validate_environment(runway_context, mock_module, env_def, strict) \
        is expected
    # all() does not give an output that can be used for troubleshooting failures
    for log in expected_logs:
        assert log in caplog.messages
Esempio n. 2
0
 def test_str_not_match(self):
     """Env not in string should not match."""
     assert not validate_environment(
         'test_module', self.MOCK_ACCOUNT_ID + '/us-east-2', os.environ)
Esempio n. 3
0
 def test_bool_not_match(self):
     """False bool should not match."""
     assert not validate_environment('test_module', False, os.environ)
Esempio n. 4
0
 def test_list_not_match(self):
     """Env not in list should not match."""
     assert not validate_environment(
         'test_module', [self.MOCK_ACCOUNT_ID + '/us-east-2'], os.environ)
Esempio n. 5
0
 def test_bool_match(self):
     """True bool should match."""
     assert validate_environment('test_module', True, os.environ)