Esempio n. 1
0
    def testGetLatestVersion(self):
        """Tests the GetLatestVersion functions."""
        download_helper_object = download_helper.PyPIDownloadHelper(
            self._DOWNLOAD_URL)

        latest_version = download_helper_object.GetLatestVersion(
            self._PROJECT_NAME, None)

        self.assertEqual(latest_version, self._PROJECT_VERSION)
Esempio n. 2
0
    def testGetProjectIdentifier(self):
        """Tests the GetProjectIdentifier functions."""
        download_helper_object = download_helper.PyPIDownloadHelper(
            self._DOWNLOAD_URL)

        project_identifier = download_helper_object.GetProjectIdentifier()

        expected_project_identifier = 'org.python.pypi.{0:s}'.format(
            self._PROJECT_NAME)

        self.assertEqual(project_identifier, expected_project_identifier)
Esempio n. 3
0
  def testGetDownloadURL(self):
    """Tests the GetDownloadURL functions."""
    download_helper_object = download_helper.PyPIDownloadHelper(
        self._DOWNLOAD_URL)

    download_url = download_helper_object.GetDownloadURL(
        self._PROJECT_NAME, self._PROJECT_VERSION)

    test_regexp = (
        r'/packages\/\w{{2}}\/\w{{2}}\/\w+\/{0:s}-{1:s}\.tar\.gz').format(
            self._PROJECT_NAME, self._PROJECT_VERSION)

    self.assertRegexpMatches(download_url, test_regexp)
Esempio n. 4
0
    def testGetDownloadURL(self):
        """Tests the GetDownloadURL functions."""
        download_helper_object = download_helper.PyPIDownloadHelper(
            self._DOWNLOAD_URL)

        download_url = download_helper_object.GetDownloadURL(
            self._PROJECT_NAME, self._PROJECT_VERSION)

        test_regexp = (
            r'/packages\/\w{{2}}\/\w{{2}}\/\w+\/{0:s}-{1:s}\.tar\.gz').format(
                self._PROJECT_NAME, self._PROJECT_VERSION)

        # pylint: disable=deprecated-method
        # TODO: replace assertRegexpMatches by assertRegexp, check if compatible
        # with Python 2 first.
        self.assertRegexpMatches(download_url, test_regexp)