Beispiel #1
0
def test_get_loader_cls():
    res = loaders.get_loader_cls(constants.ContentType.MODULE)
    assert issubclass(res, loaders.PluginLoader)
    assert not issubclass(res, loaders.RoleLoader)

    res = loaders.get_loader_cls(constants.ContentType.ROLE)
    assert issubclass(res, loaders.RoleLoader)
    assert not issubclass(res, loaders.PluginLoader)
Beispiel #2
0
 def _load_contents(self):
     """Find and load data for each content inside the collection."""
     found_contents = ContentFinder().find_contents(self.path, self.log)
     for content_type, rel_path in found_contents:
         loader_cls = loaders.get_loader_cls(content_type)
         loader = loader_cls(content_type, rel_path, self.path, self.log)
         content_obj = loader.load()
         yield content_obj