Exemplo n.º 1
0
    def test_latest_version_highest(self):
        project = Project.objects.get(slug='read-the-docs')

        data = get_version_compare_data(project)
        self.assertEqual(data['is_highest'], True)

        version = project.versions.get(slug=LATEST)
        data = get_version_compare_data(project, version)
        self.assertEqual(data['is_highest'], True)
    def test_latest_version_highest(self):
        project = Project.objects.get(slug='read-the-docs')

        data = get_version_compare_data(project)
        self.assertEqual(data['is_highest'], True)

        version = project.versions.get(slug=LATEST)
        data = get_version_compare_data(project, version)
        self.assertEqual(data['is_highest'], True)
Exemplo n.º 3
0
    def test_highest_version_over_branches(self):
        Version.objects.create(
            project=self.pip,
            verbose_name='2.0.0',
            identifier='2.0.0',
            type=BRANCH,
            active=True,
        )

        version = Version.objects.create(
            project=self.pip,
            verbose_name='1.0.0',
            identifier='1.0.0',
            type=TAG,
            active=True,
        )

        base_version = self.pip.versions.get(slug='0.8.1')
        valid_data = {
            'project': 'Version 1.0.0 of Pip ({})'.format(version.pk),
            'url': '/dashboard/pip/version/1.0.0/',
            'slug': '1.0.0',
            'version': '1.0.0',
            'is_highest': False,
        }
        returned_data = get_version_compare_data(self.pip, base_version)
        self.assertDictEqual(valid_data, returned_data)
Exemplo n.º 4
0
    def test_highest_version_without_tags(self):
        self.pip.versions.filter(type=TAG).update(type=BRANCH)

        base_version = self.pip.versions.get(slug='0.8.1')
        valid_data = {
            'project': 'Version 0.8.1 of Pip (19)',
            'url': 'https://pip.readthedocs.io/en/0.8.1/',
            'slug': '0.8.1',
            'version': '0.8.1',
            'is_highest': True,
        }
        returned_data = get_version_compare_data(self.pip, base_version)
        self.assertDictEqual(valid_data, returned_data)

        base_version = self.pip.versions.get(slug='0.8')
        valid_data = {
            'project': 'Version 0.8.1 of Pip (19)',
            'url': 'https://pip.readthedocs.io/en/0.8.1/',
            'slug': '0.8.1',
            'version': '0.8.1',
            'is_highest': False,
        }
        returned_data = get_version_compare_data(self.pip, base_version)
        self.assertDictEqual(valid_data, returned_data)

        version = Version.objects.create(
            project=self.pip,
            verbose_name='2.0.0',
            identifier='2.0.0',
            type=BRANCH,
            active=True,
            built=True,
        )
        valid_data = {
            'project': 'Version 2.0.0 of Pip ({})'.format(version.pk),
            'url': 'https://pip.readthedocs.io/en/2.0.0/',
            'slug': '2.0.0',
            'version': '2.0.0',
            'is_highest': False,
        }
        returned_data = get_version_compare_data(self.pip, base_version)
        self.assertDictEqual(valid_data, returned_data)
Exemplo n.º 5
0
 def test_highest_version_from_lower(self):
     base_version = self.pip.versions.get(slug='0.8')
     valid_data = {
         'project': 'Version 0.8.1 of Pip (19)',
         'url': '/dashboard/pip/version/0.8.1/',
         'slug': '0.8.1',
         'version': '0.8.1',
         'is_highest': False,
     }
     returned_data = get_version_compare_data(self.pip, base_version)
     self.assertDictEqual(valid_data, returned_data)
Exemplo n.º 6
0
 def test_highest_version_from_stable(self):
     base_version = self.pip.get_stable_version()
     valid_data = {
         'project': 'Version 0.8.1 of Pip (19)',
         'url': 'https://pip.readthedocs.io/en/0.8.1/',
         'slug': '0.8.1',
         'version': '0.8.1',
         'is_highest': True,
     }
     returned_data = get_version_compare_data(self.pip, base_version)
     self.assertDictEqual(valid_data, returned_data)
Exemplo n.º 7
0
    def test_highest_version_without_tags(self):
        self.pip.versions.filter(type=TAG).update(type=BRANCH)

        base_version = self.pip.versions.get(slug='0.8.1')
        valid_data = {
            'project': 'Version 0.8.1 of Pip (19)',
            'url': '/dashboard/pip/version/0.8.1/',
            'slug': '0.8.1',
            'version': '0.8.1',
            'is_highest': True,
        }
        returned_data = get_version_compare_data(self.pip, base_version)
        self.assertDictEqual(valid_data, returned_data)

        base_version = self.pip.versions.get(slug='0.8')
        valid_data = {
            'project': 'Version 0.8.1 of Pip (19)',
            'url': '/dashboard/pip/version/0.8.1/',
            'slug': '0.8.1',
            'version': '0.8.1',
            'is_highest': False,
        }
        returned_data = get_version_compare_data(self.pip, base_version)
        self.assertDictEqual(valid_data, returned_data)

        version = Version.objects.create(
            project=self.pip,
            verbose_name='2.0.0',
            identifier='2.0.0',
            type=BRANCH,
            active=True,
        )
        valid_data = {
            'project': 'Version 2.0.0 of Pip ({})'.format(version.pk),
            'url': '/dashboard/pip/version/2.0.0/',
            'slug': '2.0.0',
            'version': '2.0.0',
            'is_highest': False,
        }
        returned_data = get_version_compare_data(self.pip, base_version)
        self.assertDictEqual(valid_data, returned_data)
Exemplo n.º 8
0
 def test_highest_version_from_latest(self):
     Version.objects.create_latest(project=self.pip)
     base_version = self.pip.versions.get(slug=LATEST)
     valid_data = {
         'project': 'Version 0.8.1 of Pip (19)',
         'url': '/dashboard/pip/version/0.8.1/',
         'slug': '0.8.1',
         'version': '0.8.1',
         'is_highest': True,
     }
     returned_data = get_version_compare_data(self.pip, base_version)
     self.assertDictEqual(valid_data, returned_data)
Exemplo n.º 9
0
 def test_highest_version_from_latest(self):
     self.pip.versions.filter(slug=LATEST).update(built=True)
     base_version = self.pip.versions.get(slug=LATEST)
     valid_data = {
         'project': 'Version 0.8.1 of Pip (19)',
         'url': 'https://pip.readthedocs.io/en/0.8.1/',
         'slug': '0.8.1',
         'version': '0.8.1',
         'is_highest': True,
     }
     returned_data = get_version_compare_data(self.pip, base_version)
     self.assertDictEqual(valid_data, returned_data)
Exemplo n.º 10
0
    def test_not_highest(self):
        project = Project.objects.get(slug='read-the-docs')
        version = project.versions.get(slug='0.2.1')

        data = get_version_compare_data(project, version)
        self.assertEqual(data['is_highest'], False)
    def test_not_highest(self):
        project = Project.objects.get(slug='read-the-docs')
        version = project.versions.get(slug='0.2.1')

        data = get_version_compare_data(project, version)
        self.assertEqual(data['is_highest'], False)