示例#1
0
 def test_delete_first_version(self):
     """Delete the first repository version."""
     delete_version(self.repo, self.repo_version_hrefs[0])
     with self.assertRaises(HTTPError):
         get_content(self.repo, self.repo_version_hrefs[0])
     for repo_version_href in self.repo_version_hrefs[1:]:
         artifact_paths = get_artifact_paths(self.repo, repo_version_href)
         self.assertIn(self.content[0]['artifact'], artifact_paths)
示例#2
0
 def test_delete_first_version(self):
     """Delete the first repository version."""
     delete_version(self.repo, self.repo_version_hrefs[0])
     with self.assertRaises(HTTPError):
         get_content(self.repo, self.repo_version_hrefs[0])
     for repo_version_href in self.repo_version_hrefs[1:]:
         artifact_paths = get_artifact_paths(self.repo, repo_version_href)
         self.assertIn(self.content[0]['artifact'], artifact_paths)
示例#3
0
 def test_delete_middle_version(self):
     """Delete a middle version."""
     index = randint(1, len(self.repo_version_hrefs) - 2)
     delete_version(self.repo, self.repo_version_hrefs[index])
     with self.assertRaises(HTTPError):
         get_content(self.repo, self.repo_version_hrefs[index])
     for repo_version_href in self.repo_version_hrefs[index + 1:]:
         artifact_paths = get_artifact_paths(self.repo, repo_version_href)
         self.assertIn(self.content[index]['artifact'], artifact_paths)
示例#4
0
 def test_delete_middle_version(self):
     """Delete a middle version."""
     index = randint(1, len(self.repo_version_hrefs) - 2)
     delete_version(self.repo, self.repo_version_hrefs[index])
     with self.assertRaises(HTTPError):
         get_content(self.repo, self.repo_version_hrefs[index])
     for repo_version_href in self.repo_version_hrefs[index + 1:]:
         artifact_paths = get_artifact_paths(self.repo, repo_version_href)
         self.assertIn(self.content[index]['artifact'], artifact_paths)
示例#5
0
    def test_delete_last_version(self):
        """Delete the last repository version.

        Create a new repository version from the second-to-last repository
        version. Verify that the content unit from the old last repository
        version is not in the new last repository version.
        """
        # Delete the last repo version.
        delete_version(self.repo, self.repo_version_hrefs[-1])
        with self.assertRaises(HTTPError):
            get_content(self.repo, self.repo_version_hrefs[-1])

        # Make new repo version from new last repo version.
        self.client.post(self.repo['_versions_href'],
                         {'add_content_units': [self.content[-1]['_href']]})
        self.repo = self.client.get(self.repo['_href'])
        artifact_paths = get_artifact_paths(self.repo)
        self.assertNotIn(self.content[-2]['artifact'], artifact_paths)
        self.assertIn(self.content[-1]['artifact'], artifact_paths)
示例#6
0
    def test_delete_last_version(self):
        """Delete the last repository version.

        Create a new repository version from the second-to-last repository
        version. Verify that the content unit from the old last repository
        version is not in the new last repository version.
        """
        # Delete the last repo version.
        delete_version(self.repo, self.repo_version_hrefs[-1])
        with self.assertRaises(HTTPError):
            get_content(self.repo, self.repo_version_hrefs[-1])

        # Make new repo version from new last repo version.
        self.client.post(
            self.repo['_versions_href'],
            {'add_content_units': [self.content[-1]['_href']]}
        )
        self.repo = self.client.get(self.repo['_href'])
        artifact_paths = get_artifact_paths(self.repo)
        self.assertNotIn(self.content[-2]['artifact'], artifact_paths)
        self.assertIn(self.content[-1]['artifact'], artifact_paths)