Esempio n. 1
0
    def test_is_public_query(self):
        """Should not return the release value when DEV is false.

        Should also only include public notes."""
        assert models.get_release('firefox for android', '56.0.3') is None
        rel = models.get_release('firefox', '57.0a1')
        assert len(rel.notes) == 4
Esempio n. 2
0
    def test_is_public_query(self):
        """Should not return the release value when DEV is false.

        Should also only include public notes."""
        assert models.get_release("firefox for android", "56.0.3") is None
        rel = models.get_release("firefox", "57.0a1")
        assert len(rel.notes) == 4
Esempio n. 3
0
    def test_get_release_none_match(self, grff_mock, grfn_mock):
        """Make sure the proper exception is raised if no file matches the query"""
        grfn_mock.return_value = None
        with self.assertRaises(models.ReleaseNotFound):
            models.get_release('Firefox', '57.0')

        expected_calls = [
            call('Firefox', ch, '57.0') for ch in models.Release.CHANNELS
        ]
        grfn_mock.assert_has_calls(expected_calls)
Esempio n. 4
0
 def test_get_release_esr(self, grff_mock, grfn_mock):
     grfn_mock.return_value = 'dude'
     grff_mock.return_value = 'dude is released'
     ret = models.get_release('Firefox Extended Support Release', '51.0')
     grfn_mock.assert_called_with('firefox', 'esr', '51.0')
     grff_mock.assert_called_with('dude')
     assert ret == 'dude is released'
Esempio n. 5
0
 def test_get_bug_search_url(self):
     rel = models.get_release('firefox', '57.0a1')
     assert '=Firefox%2057&' in rel.get_bug_search_url()
     rel.product = 'Thunderbird'
     assert '=Thunderbird%2057.0&' in rel.get_bug_search_url()
     rel.bug_search_url = 'custom url'
     assert 'custom url' == rel.get_bug_search_url()
Esempio n. 6
0
 def test_get_bug_search_url(self):
     rel = models.get_release('firefox', '57.0a1')
     assert '=Firefox%2057&' in rel.get_bug_search_url()
     rel.product = 'Thunderbird'
     assert '=Thunderbird%2057.0&' in rel.get_bug_search_url()
     rel.bug_search_url = 'custom url'
     assert 'custom url' == rel.get_bug_search_url()
Esempio n. 7
0
 def test_non_public_release_not_duped(self):
     # refresh again
     models.ProductRelease.objects.refresh()
     release_cache.clear()
     # non public release
     # should NOT raise multiple objects error
     assert models.get_release('firefox for android', '56.0.3', include_drafts=True)
Esempio n. 8
0
    def test_get_release_none_match(self, manager_mock):
        """Make sure the proper exception is raised if no file matches the query"""
        manager_mock.product().get.side_effect = models.ProductRelease.DoesNotExist
        assert models.get_release('Firefox', '57.0') is None

        expected_calls = chain.from_iterable((call('Firefox', ch, '57.0'), call().get()) for ch in models.ProductRelease.CHANNELS)
        manager_mock.product.assert_has_calls(expected_calls)
Esempio n. 9
0
 def test_get_release(self, grff_mock, grfn_mock):
     grfn_mock.return_value = 'dude'
     grff_mock.return_value = 'dude is released'
     ret = models.get_release('Firefox', '57.0')
     grfn_mock.assert_called_with('Firefox', models.Release.CHANNELS[0],
                                  '57.0')
     grff_mock.assert_called_with('dude')
     assert ret == 'dude is released'
Esempio n. 10
0
 def test_non_public_release_not_duped(self):
     # refresh again
     models.ProductRelease.objects.refresh()
     release_cache.clear()
     # non public release
     # should NOT raise multiple objects error
     assert models.get_release("firefox for android",
                               "56.0.3",
                               include_drafts=True)
Esempio n. 11
0
    def test_get_release_none_match(self, manager_mock):
        """Make sure the proper exception is raised if no file matches the query"""
        manager_mock.product(
        ).get.side_effect = models.ProductRelease.DoesNotExist
        assert models.get_release("Firefox", "57.0") is None

        expected_calls = chain.from_iterable(
            (call("Firefox", ch, "57.0", False), call().get())
            for ch in models.ProductRelease.CHANNELS)
        manager_mock.product.assert_has_calls(expected_calls)
Esempio n. 12
0
    def test_field_processors(self):
        rel = models.get_release('firefox', '57.0a1')
        # datetime conversion
        assert rel.created.year == 2017
        # datetime conversion
        assert rel.modified.year == 2017
        # date conversion
        assert rel.release_date.year == 2017
        # markdown
        assert rel.system_requirements.startswith('<h2 id="windows">Windows</h2>')
        # version
        assert rel.version_obj.major == 57

        # notes
        note = rel.notes[0]
        # datetime conversion
        assert note.created.year == 2017
        # datetime conversion
        assert note.modified.year == 2017
        # markdown
        assert note.note.startswith('<p>Firefox Nightly')
        assert note.id == 787203
Esempio n. 13
0
    def test_field_processors(self):
        rel = models.get_release("firefox", "57.0a1")
        # datetime conversion
        assert rel.created.year == 2017
        # datetime conversion
        assert rel.modified.year == 2017
        # date conversion
        assert rel.release_date.year == 2017
        # markdown
        assert rel.system_requirements.startswith(
            '<h2 id="windows">Windows</h2>')
        # version
        assert rel.version_obj.major == 57

        # notes
        note = rel.notes[0]
        # datetime conversion
        assert note.created.year == 2017
        # datetime conversion
        assert note.modified.year == 2017
        # markdown
        assert note.note.startswith("<p>Firefox Nightly")
        assert note.id == 787203
Esempio n. 14
0
 def test_latest_release(self):
     correct_release = models.get_release('firefox for android', '56.0.2')
     assert models.get_latest_release('firefox for android',
                                      'release') == correct_release
Esempio n. 15
0
 def test_equivalent_release_for_product_none_match(self):
     rel = models.get_release("firefox", "45.0esr")
     android = rel.equivalent_release_for_product("Firefox for Android")
     assert android is None
Esempio n. 16
0
 def test_get_release_esr(self, manager_mock):
     manager_mock.product().get.return_value = 'dude is released'
     assert models.get_release('Firefox Extended Support Release',
                               '51.0') == 'dude is released'
     manager_mock.product.assert_called_with(
         'Firefox Extended Support Release', 'esr', '51.0', False)
Esempio n. 17
0
 def test_release_major_version__ff100(self):
     self._add_in_ff100()
     rel = models.get_release("firefox", "100.0a1")
     assert rel.major_version == "100"
Esempio n. 18
0
 def test_get_bug_search_url__ff100(self):
     self._add_in_ff100()
     rel = models.get_release("firefox", "100.0a1")
     assert "=Firefox%20100&" in rel.get_bug_search_url()
     rel.bug_search_url = "custom url"
     assert "custom url" == rel.get_bug_search_url()
Esempio n. 19
0
 def test_equivalent_release_for_product(self):
     """Based on the test files the equivalent release for 56 should be 56.0.2"""
     rel = models.get_release('firefox', '56.0', 'release')
     android = rel.equivalent_release_for_product('Firefox for Android')
     assert android.version == '56.0.2'
     assert android.product == 'Firefox for Android'
Esempio n. 20
0
 def test_release_major_version(self):
     rel = models.get_release('firefox', '57.0a1')
     assert rel.major_version == '57'
Esempio n. 21
0
 def test_is_public_field_processor_dev_true(self):
     """Should always be true when DEV is true."""
     rel = models.get_release('firefox for android', '56.0.3')
     assert rel.is_public
     rel = models.get_release('firefox', '57.0a1')
     assert len(rel.notes) == 6
Esempio n. 22
0
 def test_get_release(self, manager_mock):
     manager_mock.product().get.return_value = "dude is released"
     assert models.get_release("Firefox", "57.0") == "dude is released"
     manager_mock.product.assert_called_with(
         "Firefox", models.ProductRelease.CHANNELS[0], "57.0", False)
Esempio n. 23
0
 def test_get_release_esr(self, manager_mock):
     manager_mock.product().get.return_value = 'dude is released'
     assert models.get_release('Firefox Extended Support Release', '51.0') == 'dude is released'
     manager_mock.product.assert_called_with('Firefox Extended Support Release', 'esr', '51.0')
Esempio n. 24
0
 def test_get_release(self, manager_mock):
     manager_mock.product().get.return_value = 'dude is released'
     assert models.get_release('Firefox', '57.0') == 'dude is released'
     manager_mock.product.assert_called_with('Firefox', models.ProductRelease.CHANNELS[0], '57.0')
Esempio n. 25
0
 def test_is_public_field_processor_dev_true(self):
     """Should always be true when DEV is true."""
     models.get_release('firefox for android', '56.0.3')
     rel = models.get_release('firefox', '57.0a1')
     assert len(rel.notes) == 6
Esempio n. 26
0
 def test_note_fixed_in_release(self):
     rel = models.get_release('firefox', '55.0a1')
     note = rel.notes[11]
     with self.activate('en-US'):
         assert note.fixed_in_release.get_absolute_url(
         ) == '/en-US/firefox/55.0a1/releasenotes/'
Esempio n. 27
0
 def test_equivalent_release_for_product_none_match(self):
     rel = models.get_release('firefox', '45.0esr')
     android = rel.equivalent_release_for_product('Firefox for Android')
     assert android is None
Esempio n. 28
0
 def test_is_public_field_processor_dev_true(self):
     """Should always be true when DEV is true."""
     models.get_release("firefox for android", "56.0.3")
     rel = models.get_release("firefox", "57.0a1")
     assert len(rel.notes) == 6
Esempio n. 29
0
 def test_latest_release(self):
     correct_release = models.get_release('firefox for android', '56.0.2')
     assert models.get_latest_release('firefox for android', 'release') == correct_release
Esempio n. 30
0
 def test_get_release_esr(self, manager_mock):
     manager_mock.product().get.return_value = "dude is released"
     assert models.get_release("Firefox Extended Support Release",
                               "51.0") == "dude is released"
     manager_mock.product.assert_called_with(
         "Firefox Extended Support Release", "esr", "51.0", False)
Esempio n. 31
0
 def test_release_major_version(self):
     rel = models.get_release('firefox', '57.0a1')
     assert rel.major_version == '57'
Esempio n. 32
0
 def test_latest_release(self):
     correct_release = models.get_release("firefox for android", "56.0.2")
     assert models.get_latest_release("firefox for android",
                                      "release") == correct_release
Esempio n. 33
0
 def test_is_public_field_processor(self):
     """Should return the real value when DEV is false."""
     rel = models.get_release('firefox for android', '56.0.3')
     assert not rel.is_public
     rel = models.get_release('firefox', '57.0a1')
     assert len(rel.notes) == 4
Esempio n. 34
0
 def test_release_major_version(self):
     rel = models.get_release("firefox", "57.0a1")
     assert rel.major_version == "57"
Esempio n. 35
0
 def test_equivalent_release_for_product(self):
     """Based on the test files the equivalent release for 56 should be 56.0.2"""
     rel = models.get_release('firefox', '56.0', 'release')
     android = rel.equivalent_release_for_product('Firefox for Android')
     assert android.version == '56.0.2'
     assert android.product == 'Firefox for Android'
Esempio n. 36
0
 def test_get_bug_search_url(self):
     rel = models.get_release("firefox", "57.0a1")
     assert "=Firefox%2057&" in rel.get_bug_search_url()
     rel.bug_search_url = "custom url"
     assert "custom url" == rel.get_bug_search_url()
Esempio n. 37
0
 def test_equivalent_release_for_product_none_match(self):
     rel = models.get_release('firefox', '45.0esr')
     android = rel.equivalent_release_for_product('Firefox for Android')
     assert android is None
Esempio n. 38
0
 def test_equivalent_release_for_product(self):
     """Based on the test files the equivalent release for 56 should be 56.0.2"""
     rel = models.get_release("firefox", "56.0", "release")
     android = rel.equivalent_release_for_product("Firefox for Android")
     assert android.version == "56.0.2"
     assert android.product == "Firefox for Android"
Esempio n. 39
0
 def test_note_fixed_in_release(self):
     rel = models.get_release('firefox', '55.0a1')
     note = rel.notes[11]
     with self.activate('en-US'):
         assert note.fixed_in_release.get_absolute_url() == '/en-US/firefox/55.0a1/releasenotes/'
Esempio n. 40
0
 def test_note_fixed_in_release(self):
     rel = models.get_release("firefox", "55.0a1")
     note = rel.notes[11]
     with self.activate("en-US"):
         assert note.fixed_in_release.get_absolute_url(
         ) == "/en-US/firefox/55.0a1/releasenotes/"
Esempio n. 41
0
 def test_get_release(self, manager_mock):
     manager_mock.product().get.return_value = 'dude is released'
     assert models.get_release('Firefox', '57.0') == 'dude is released'
     manager_mock.product.assert_called_with(
         'Firefox', models.ProductRelease.CHANNELS[0], '57.0', False)