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
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
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)
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'
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()
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)
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)
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'
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)
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)
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
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
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
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
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)
def test_release_major_version__ff100(self): self._add_in_ff100() rel = models.get_release("firefox", "100.0a1") assert rel.major_version == "100"
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()
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'
def test_release_major_version(self): rel = models.get_release('firefox', '57.0a1') assert rel.major_version == '57'
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
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)
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')
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')
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
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/'
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
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
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)
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
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
def test_release_major_version(self): rel = models.get_release("firefox", "57.0a1") assert rel.major_version == "57"
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()
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"
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/'
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/"
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)