Beispiel #1
0
    def test_resolve_and_merge_references_with_app_no_dict(self):
        paths = ['path1', 'path2']

        app = 'nodict'
        doc = {'name': 'test', 'app': app}

        with mock.patch("riptide.config.document.project.load_subdocument",
                        side_effect=side_effect_for_load_subdocument()):
            project = module.Project(doc)
            with self.assertRaises(ConfigcrunchError):
                project.resolve_and_merge_references(paths)
Beispiel #2
0
    def test_resolve_and_merge_references_with_app(self):
        paths = ['path1', 'path2']

        app = {'key1': 'value1'}
        doc = {'name': 'test', 'app': app}

        with mock.patch("riptide.config.document.project.load_subdocument",
                        side_effect=side_effect_for_load_subdocument()
                        ) as load_subdoc_mock:
            project = module.Project(doc)
            project.resolve_and_merge_references(paths)

            self.assertIsInstance(project['app'], YamlConfigDocumentStub)
            self.assertEqual(app, project['app'].doc)

            load_subdoc_mock.assert_has_calls([
                call(app, project, module.App, paths),
            ],
                                              any_order=True)
Beispiel #3
0
 def test_folder(self, dirname_mock: Mock):
     project = module.Project({'$path': '$%%PATH%%$'})
     self.assertEqual('$%%DIRNAME%%$', project.folder())
     dirname_mock.assert_called_once_with('$%%PATH%%$')
Beispiel #4
0
 def test_folder_no_path(self):
     project = module.Project({})
     self.assertIsNone(project.folder())
Beispiel #5
0
 def test_resolve_and_merge_references_no_subdocs(self, super_mock):
     doc = {'name': 'test'}
     project = module.Project(doc)
     project.resolve_and_merge_references(['./path1', './path2'])
     super_mock.assert_called_once_with(['./path1', './path2'])
Beispiel #6
0
 def test_header(self):
     cmd = module.Project({})
     self.assertEqual(module.HEADER, cmd.header())
Beispiel #7
0
 def test_src_folder(self, dirname_mock: Mock):
     project = module.Project({'$path': '$PATH', 'src': '$SRC'})
     self.assertEqual(os.path.join('$DIRNAME', '$SRC'),
                      project.src_folder())
     dirname_mock.assert_called_once_with('$PATH')