Exemple #1
0
 def test_load_register_custom_lookups(self):
     """Test load register custom lookups."""
     config = Config({
         "lookups": {
             "custom": "importlib.import_module"}})
     load(config)
     self.assertTrue(callable(CFNGIN_LOOKUP_HANDLERS["custom"]))
Exemple #2
0
 def test_lookup_with_sys_path(self):
     """Test lookup with sys path."""
     config = Config({
         "sys_path": "./tests/cfngin",
         "lookups": {
             "custom": "fixtures.mock_lookups.handler"}})
     load(config)
     self.assertTrue(callable(CFNGIN_LOOKUP_HANDLERS["custom"]))
Exemple #3
0
 def test_hook_with_sys_path(self):
     """Test hook with sys path."""
     config = Config({
         "namespace":
         "test",
         "sys_path":
         "./tests/unit/cfngin",
         "pre_build": [{
             "data_key": "myHook",
             "path": "fixtures.mock_hooks.mock_hook",
             "required": True,
             "args": {
                 "value": "mockResult"
             },
         }],
     })
     load(config)
     context = Context(config=config)
     stage = "pre_build"
     handle_hooks(stage, context.config[stage], "mock-region-1", context)
     self.assertEqual("mockResult", context.hook_data["myHook"]["result"])
Exemple #4
0
 def test_load_adds_sys_path(self):
     """Test load adds sys path."""
     config = Config({"sys_path": "/foo/bar"})
     load(config)
     self.assertIn("/foo/bar", sys.path)