Beispiel #1
0
    def test_get_modules(self, sample_version, sample_manifest):
        mock_api = MagicMock()
        mock_api.manifest.return_value = Manifest(sample_manifest, None)
        version = Version(sample_version, mock_api)
        modules = version.get_modules()

        assert len(modules) == len(sample_manifest["modules"])
Beispiel #2
0
    def test_get_manifest(self, sample_version, sample_manifest):
        mock_api = MagicMock()
        mock_api.manifest.return_value = Manifest(sample_manifest, None)
        version = Version(sample_version, mock_api)
        manifest = version.get_manifest()

        mock_api.manifest.assert_called_with(sample_version['project'], sample_version['revision'])
        assert len(manifest.modules) == len(sample_manifest['modules'])
Beispiel #3
0
 def test_manifest_modules(self, sample_manifest):
     manifest = Manifest(sample_manifest, None)
     assert len(manifest.modules) == len(sample_manifest['modules'])
     for module in sample_manifest['modules']:
         assert module in manifest.modules
         manifest_module = manifest.modules[module]
         assert manifest_module.name == module
         assert manifest_module.revision == sample_manifest['modules'][
             module]['revision']
Beispiel #4
0
    def manifest_for_task(self, task_id: str) -> Manifest:
        """
        Get the manifest for the given task.

        :param task_id: Task Id fo query.
        :return: Manifest for the given task.
        """
        url = self._create_url(f"/tasks/{task_id}/manifest")
        return Manifest(self._call_api(url).json(), self)  # type: ignore[arg-type]
Beispiel #5
0
    def manifest(self, project_id, revision):
        """
        Get the manifest for the given revision.

        :param project_id: Project the revision belongs to.
        :param revision: Revision to get manifest of.
        :return: Manifest of the given revision of the given project.
        """
        url = self._create_old_url(
            'plugin/manifest/get/{project_id}/{revision}'.format(
                project_id=project_id, revision=revision))
        return Manifest(self._call_api(url).json(), self)
Beispiel #6
0
    def manifest(self, project_id: str, revision: str) -> Manifest:
        """
        Get the manifest for the given revision.

        :param project_id: Project the revision belongs to.
        :param revision: Revision to get manifest of.
        :return: Manifest of the given revision of the given project.
        """
        url = self._create_old_url(
            f"plugin/manifest/get/{project_id}/{revision}")
        return Manifest(self._call_api(url).json(),
                        self)  # type: ignore[arg-type]
Beispiel #7
0
 def test_get_attributes(self, sample_manifest):
     manifest = Manifest(sample_manifest, None)
     assert manifest.id == sample_manifest['id']
     assert manifest.revision == sample_manifest['revision']