예제 #1
0
 def test_get_release_or_404(self, get_release):
     eq_(views.get_release_or_404('version', 'product'),
         get_release.return_value)
     get_release.assert_called_with('product', 'version')
     get_release.side_effect = ReleaseNotFound
     with self.assertRaises(Http404):
         views.get_release_or_404('version', 'product')
예제 #2
0
파일: test_base.py 프로젝트: Sancus/bedrock
 def test_non_public_release(self, get_object_or_404):
     """
     Should raise 404 if not release.is_public and not settings.DEV
     """
     get_object_or_404.return_value = Release(is_public=False)
     with self.assertRaises(Http404):
         views.get_release_or_404('42', 'Firefox')
예제 #3
0
 def test_non_public_release(self, get_release):
     """
     Should raise 404 if release is not public and not settings.DEV
     """
     get_release.return_value = None
     with self.assertRaises(Http404):
         views.get_release_or_404('42', 'Firefox')
예제 #4
0
 def test_non_public_release(self, get_release):
     """
     Should raise 404 if release is not public and not settings.DEV
     """
     get_release.return_value = None
     with self.assertRaises(Http404):
         views.get_release_or_404('42', 'Firefox')
예제 #5
0
 def test_non_public_release(self, get_object_or_404):
     """
     Should raise 404 if not release.is_public and not settings.DEV
     """
     get_object_or_404.return_value = Release(is_public=False)
     with self.assertRaises(Http404):
         views.get_release_or_404('42', 'Firefox')
예제 #6
0
 def test_get_release_or_404(self, get_release):
     assert views.get_release_or_404("version",
                                     "product") == get_release.return_value
     get_release.assert_called_with("product", "version", None, False)
     get_release.return_value = None
     with self.assertRaises(Http404):
         views.get_release_or_404("version", "product")
예제 #7
0
 def test_get_release_or_404(self, get_release):
     eq_(views.get_release_or_404('version', 'product'),
         get_release.return_value)
     get_release.assert_called_with('product', 'version', None, False)
     get_release.return_value = None
     with self.assertRaises(Http404):
         views.get_release_or_404('version', 'product')
예제 #8
0
 def test_get_release_or_404(self, get_release):
     assert (views.get_release_or_404(
         'version', 'product') == get_release.return_value)
     get_release.assert_called_with('product', 'version', None, False)
     get_release.return_value = None
     with self.assertRaises(Http404):
         views.get_release_or_404('version', 'product')
예제 #9
0
파일: test_base.py 프로젝트: szyka/bedrock
 def test_non_public_release(self):
     """
     Should raise 404 if release is not public and not settings.DEV, unless
     the include_drafts option is enabled
     """
     with self.assertRaises(Http404):
         views.get_release_or_404('58.0a1', 'Firefox')
     eq_(
         views.get_release_or_404('58.0a1', 'Firefox', True).is_public,
         False)
예제 #10
0
 def test_get_release_or_404(self, Q, get_object_or_404):
     eq_(views.get_release_or_404('version', 'product'),
         get_object_or_404.return_value)
     get_object_or_404.assert_called_with(Release,
                                          Q.return_value,
                                          version='version')
     Q.assert_called_once_with(product='product')
예제 #11
0
 def test_non_public_release(self):
     """
     Should raise 404 if release is not public and not settings.DEV, unless
     the include_drafts option is enabled
     """
     with self.assertRaises(Http404):
         views.get_release_or_404('58.0a1', 'Firefox')
     eq_(views.get_release_or_404('58.0a1', 'Firefox', True).is_public, False)
     with self.assertRaises(Http404):
         views.get_release_or_404('58.0a1', 'Firefox for Android')
     eq_(views.get_release_or_404('58.0a1', 'Firefox for Android', True).is_public, False)
예제 #12
0
 def test_non_public_release(self):
     """
     Should raise 404 if release is not public and not settings.DEV, unless
     the include_drafts option is enabled
     """
     with self.assertRaises(Http404):
         views.get_release_or_404("58.0a1", "Firefox")
     assert not views.get_release_or_404("58.0a1", "Firefox",
                                         True).is_public
     with self.assertRaises(Http404):
         views.get_release_or_404("58.0a1", "Firefox for Android")
     assert not views.get_release_or_404("58.0a1", "Firefox for Android",
                                         True).is_public
예제 #13
0
 def test_get_release_or_404_esr(self):
     rel = views.get_release_or_404('24.5.0', 'Firefox')
     eq_(rel.version, '24.5.0')
     eq_(rel.channel, 'ESR')
예제 #14
0
 def test_get_release_or_404_endswith_esr(self):
     rel = views.get_release_or_404("45.0esr", "Firefox")
     assert rel.version == "45.0esr"
     assert rel.channel == "ESR"
예제 #15
0
 def test_get_release_or_404_esr(self):
     rel = views.get_release_or_404("24.5.0", "Firefox")
     assert rel.version == "24.5.0"
     assert rel.channel == "ESR"
예제 #16
0
 def test_get_release_or_404_esr(self):
     rel = views.get_release_or_404('24.5.0', 'Firefox')
     assert rel.version == '24.5.0'
     assert rel.channel == 'ESR'
예제 #17
0
 def test_get_release_or_404_endswith_esr(self, Q, get_object_or_404):
     eq_(views.get_release_or_404('45.0esr', 'Firefox'),
         get_object_or_404.return_value)
     Q.assert_any_call(product='Firefox')
     Q.assert_any_call(product='Firefox Extended Support Release')
예제 #18
0
 def test_get_release_or_404_endswith_esr(self):
     rel = views.get_release_or_404('45.0esr', 'Firefox')
     assert rel.version == '45.0esr'
     assert rel.channel == 'ESR'
예제 #19
0
파일: test_base.py 프로젝트: Sancus/bedrock
 def test_get_release_or_404_endswith_esr(self, Q, get_object_or_404):
     eq_(views.get_release_or_404('45.0esr', 'Firefox'),
         get_object_or_404.return_value)
     Q.assert_any_call(product='Firefox')
     Q.assert_any_call(product='Firefox Extended Support Release')
예제 #20
0
파일: test_base.py 프로젝트: Sancus/bedrock
 def test_get_release_or_404(self, Q, get_object_or_404):
     eq_(views.get_release_or_404('version', 'product'),
         get_object_or_404.return_value)
     get_object_or_404.assert_called_with(
         Release, Q.return_value, version='version')
     Q.assert_called_once_with(product='product')
예제 #21
0
 def test_get_release_or_404(self, Q, get_object_or_404):
     eq_(views.get_release_or_404("version", "product"), get_object_or_404.return_value)
     get_object_or_404.assert_called_with(Release, Q.return_value, version="version")
     Q.assert_called_with(product="product")
예제 #22
0
 def test_get_release_or_404_esr(self, Q, get_object_or_404):
     eq_(views.get_release_or_404("24.5.0", "Firefox"), get_object_or_404.return_value)
     Q.assert_any_call(product="Firefox")
     Q.assert_any_call(product="Firefox Extended Support Release")
     Q.__or__.assert_called()
예제 #23
0
 def test_get_release_or_404_esr(self):
     rel = views.get_release_or_404('24.5.0', 'Firefox')
     assert rel.version == '24.5.0'
     assert rel.channel == 'ESR'
예제 #24
0
 def test_get_release_or_404_endswith_esr(self):
     rel = views.get_release_or_404('45.0esr', 'Firefox')
     eq_(rel.version, '45.0esr')
     eq_(rel.channel, 'ESR')
예제 #25
0
 def test_get_release_or_404_esr(self):
     rel = views.get_release_or_404('24.5.0', 'Firefox')
     eq_(rel.version, '24.5.0')
     eq_(rel.channel, 'ESR')
예제 #26
0
 def test_get_release_or_404_endswith_esr(self):
     rel = views.get_release_or_404('45.0esr', 'Firefox')
     assert rel.version == '45.0esr'
     assert rel.channel == 'ESR'
예제 #27
0
 def test_get_release_or_404_endswith_esr(self):
     rel = views.get_release_or_404('45.0esr', 'Firefox')
     eq_(rel.version, '45.0esr')
     eq_(rel.channel, 'ESR')