Fix tests after review flag changes.
This commit is contained in:
Родитель
8fda5e5067
Коммит
527c15008c
|
@ -99,57 +99,12 @@ class TestViewPendingQueueTable(amo.tests.TestCase):
|
|||
row.waiting_time_min = 0
|
||||
eq_(self.table.render_waiting_time_min(row), u'moments ago')
|
||||
|
||||
def test_flags_admin_review(self):
|
||||
def test_flags(self):
|
||||
row = Mock()
|
||||
row.admin_review = True
|
||||
row.flags = [('admin-review', 'Admin Review')]
|
||||
doc = pq(self.table.render_flags(row))
|
||||
assert doc('div.ed-sprite-admin-review').length
|
||||
|
||||
def test_flags_info_request(self):
|
||||
row = Mock()
|
||||
row.has_info_request = True
|
||||
doc = pq(self.table.render_flags(row))
|
||||
assert doc('div.ed-sprite-info').length
|
||||
|
||||
def test_flags_editor_comment(self):
|
||||
row = Mock()
|
||||
row.has_editor_comment = True
|
||||
doc = pq(self.table.render_flags(row))
|
||||
assert doc('div.ed-sprite-editor').length
|
||||
|
||||
def test_flags_jetpack_and_restartless(self):
|
||||
row = Mock()
|
||||
row.is_jetpack = True
|
||||
row.is_restartless = True
|
||||
doc = pq(self.table.render_flags(row))
|
||||
eq_(doc('div.ed-sprite-jetpack').length, 1)
|
||||
eq_(doc('div.ed-sprite-restartless').length, 0)
|
||||
|
||||
def test_flags_restartless(self):
|
||||
row = Mock()
|
||||
row.is_restartless = True
|
||||
row.is_jetpack = False
|
||||
doc = pq(self.table.render_flags(row))
|
||||
eq_(doc('div.ed-sprite-jetpack').length, 0)
|
||||
eq_(doc('div.ed-sprite-restartless').length, 1)
|
||||
|
||||
def test_flags_jetpack(self):
|
||||
row = Mock()
|
||||
row.is_jetpack = True
|
||||
doc = pq(self.table.render_flags(row))
|
||||
eq_(doc('div.ed-sprite-restartless').length, 0)
|
||||
eq_(doc('div.ed-sprite-jetpack').length, 1)
|
||||
|
||||
def test_no_flags(self):
|
||||
row = Mock()
|
||||
row.is_restartless = False
|
||||
row.is_jetpack = False
|
||||
row.admin_review = False
|
||||
row.has_editor_comment = False
|
||||
row.has_info_request = False
|
||||
row.is_premium = False
|
||||
eq_(self.table.render_flags(row), '')
|
||||
|
||||
|
||||
class TestAdditionalInfoInQueue(amo.tests.TestCase):
|
||||
|
||||
|
|
|
@ -146,6 +146,48 @@ class TestPendingQueue(TestQueue):
|
|||
# Time zone will be off, hard to test this.
|
||||
assert row.waiting_time_hours is not None
|
||||
|
||||
# These apply to all queues, except that all add-ons in the Fast
|
||||
# Track queue are Jetpack
|
||||
def test_flags_admin_review(self):
|
||||
f = self.new_file(version=u'0.1')
|
||||
f['addon'].update(admin_review=True)
|
||||
|
||||
q = self.Queue.objects.get()
|
||||
eq_(q.flags, [('admin-review', 'Admin Review')])
|
||||
|
||||
def test_flags_info_request(self):
|
||||
f = self.new_file(version=u'0.1')
|
||||
f['version'].update(has_info_request=True)
|
||||
q = self.Queue.objects.get()
|
||||
eq_(q.flags, [('info', 'More Information Requested')])
|
||||
|
||||
def test_flags_editor_comment(self):
|
||||
f = self.new_file(version=u'0.1')
|
||||
f['version'].update(has_editor_comment=True)
|
||||
|
||||
q = self.Queue.objects.get()
|
||||
eq_(q.flags, [('editor', 'Contains Editor Comment')])
|
||||
|
||||
def test_flags_jetpack_and_restartless(self):
|
||||
f = self.new_file(version=u'0.1')
|
||||
f['file'].update(jetpack_version='1.8', no_restart=True)
|
||||
|
||||
q = self.Queue.objects.get()
|
||||
eq_(q.flags, [('jetpack', 'Jetpack Add-on')])
|
||||
|
||||
def test_flags_restartless(self):
|
||||
f = self.new_file(version=u'0.1')
|
||||
f['file'].update(no_restart=True)
|
||||
|
||||
q = self.Queue.objects.get()
|
||||
eq_(q.flags, [('restartless', 'Restartless Add-on')])
|
||||
|
||||
def test_no_flags(self):
|
||||
self.new_file(version=u'0.1')
|
||||
|
||||
q = self.Queue.objects.get()
|
||||
eq_(q.flags, [])
|
||||
|
||||
|
||||
class TestFullReviewQueue(TestQueue):
|
||||
__test__ = True
|
||||
|
|
|
@ -1467,8 +1467,7 @@ class TestReview(ReviewBase):
|
|||
eq_(len(response.context['flags']), 0)
|
||||
|
||||
def test_flags(self):
|
||||
Review.objects.create(addon=self.addon, flag=True, user=self.editor)
|
||||
Review.objects.create(addon=self.addon, flag=False, user=self.editor)
|
||||
self.addon.update(admin_review=True)
|
||||
response = self.client.get(self.url)
|
||||
eq_(len(response.context['flags']), 1)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче