Ejemplo n.º 1
0
    def test_bad_args_raise_error(self):
        api = models.VersionString()
        with pytest.raises(models.RequiredParameterError):
            api.get()

        with pytest.raises(models.RequiredParameterError):
            api.get(product='Firefox', channel='beta')
Ejemplo n.º 2
0
    def test_beta_and_rc(self):
        """If there are multiple version strings for a given (product, channel,
        build_id), and they have 'b' in them, then we want the non-rc one.

        """
        models.ProductVersion.objects.create(
            product_name='Firefox',
            release_channel='beta',
            build_id='20160920155715',
            version_string='50.0b1rc2',
            major_version=50,
        )
        models.ProductVersion.objects.create(
            product_name='Firefox',
            release_channel='beta',
            build_id='20160920155715',
            version_string='50.0b1rc1',
            major_version=50,
        )
        models.ProductVersion.objects.create(
            product_name='Firefox',
            release_channel='beta',
            build_id='20160920155715',
            version_string='50.0b1',
            major_version=50,
        )

        api = models.VersionString()
        resp = api.get(product='Firefox',
                       channel='beta',
                       build_id='20160920155715')
        assert resp == {'hits': [{'version_string': '50.0b1'}], 'total': 1}
Ejemplo n.º 3
0
    def test_beta_and_rc(self):
        """If there are multiple version strings for a given (product, channel,
        build_id), and they have 'b' in them, then we want the non-rc one.

        """
        models.ProductVersion.objects.create(
            product_name="Firefox",
            release_channel="beta",
            build_id="20160920155715",
            version_string="50.0b1rc2",
            major_version=50,
        )
        models.ProductVersion.objects.create(
            product_name="Firefox",
            release_channel="beta",
            build_id="20160920155715",
            version_string="50.0b1rc1",
            major_version=50,
        )
        models.ProductVersion.objects.create(
            product_name="Firefox",
            release_channel="beta",
            build_id="20160920155715",
            version_string="50.0b1",
            major_version=50,
        )

        api = models.VersionString()
        resp = api.get(product="Firefox",
                       channel="beta",
                       build_id="20160920155715")
        assert resp == {"hits": [{"version_string": "50.0b1"}], "total": 1}
Ejemplo n.º 4
0
    def test_beta(self):
        models.ProductVersion.objects.create(
            product_name="Firefox",
            release_channel="beta",
            build_id="20161129164126",
            version_string="51.0b5",
            major_version=51,
        )

        api = models.VersionString()
        resp = api.get(product="Firefox", channel="beta", build_id="20161129164126")
        assert resp == {"hits": [{"version_string": "51.0b5"}], "total": 1}
Ejemplo n.º 5
0
    def test_beta(self):
        models.ProductVersion.objects.create(
            product_name='Firefox',
            release_channel='beta',
            build_id='20161129164126',
            version_string='51.0b5',
            major_version=51,
        )

        api = models.VersionString()
        resp = api.get(product='Firefox',
                       channel='beta',
                       build_id='20161129164126')
        assert resp == {'hits': [{'version_string': '51.0b5'}], 'total': 1}
Ejemplo n.º 6
0
    def test_release_rc(self):
        """If the channel is beta, but there aren't versions with 'b' in them,
        then these are release candidates for a final release, so return an rc one.

        """
        models.ProductVersion.objects.create(
            product_name="Firefox",
            release_channel="beta",
            build_id="20161104212021",
            version_string="50.0rc2",
            major_version=50,
        )

        api = models.VersionString()
        resp = api.get(product="Firefox", channel="beta", build_id="20161104212021")
        assert resp == {"hits": [{"version_string": "50.0rc2"}], "total": 1}
Ejemplo n.º 7
0
    def test_release_rc(self):
        """If the channel is beta, but there aren't versions with 'b' in them,
        then these are release candidates for a final release, so return an rc one.

        """
        models.ProductVersion.objects.create(
            product_name='Firefox',
            release_channel='beta',
            build_id='20161104212021',
            version_string='50.0rc2',
            major_version=50,
        )

        api = models.VersionString()
        resp = api.get(product='Firefox',
                       channel='beta',
                       build_id='20161104212021')
        assert resp == {'hits': [{'version_string': '50.0rc2'}], 'total': 1}