def test_mix_pending_flagged_data_id(self): """ Case where reviewer holds locks for both pending and flagged themes. Calculating theme_lock_count on themes_more should be correct. """ reviewer = self.create_and_become_reviewer() # Check out pending themes. for x in range(rvw.THEME_INITIAL_LOCKS + 1): addon_factory(type=amo.ADDON_PERSONA, status=amo.STATUS_PENDING) req = self.req_factory_factory(reviewer, "reviewers.themes.queue_themes") _get_themes(req, req.user.get_profile(), initial=True) # Check out flagged themes. for x in range(rvw.THEME_INITIAL_LOCKS + 1): addon_factory(type=amo.ADDON_PERSONA, status=amo.STATUS_REVIEW_PENDING) req = self.req_factory_factory(reviewer, "reviewers.themes.queue_flagged") _get_themes(req, req.user.get_profile(), initial=True, flagged=True) # Get more flagged themes. req = self.req_factory_factory(reviewer, "reviewers.themes.more_flagged") res = themes_more(req, flagged=True) themes = pq(json.loads(res.content)["html"])(".theme") eq_(pq(themes[0]).attr("data-id"), "2") # Get more pending themes. req = self.req_factory_factory(reviewer, "reviewers.themes.more") res = themes_more(req) themes = pq(json.loads(res.content)["html"])(".theme") eq_(pq(themes[0]).attr("data-id"), "2")
def test_themes_more_data_id(self): """Check data-id of async'ed grabbed themes.""" req, themes = self.themes_more_helper() res = themes_more(req, flagged=self.flagged) themes = pq(json.loads(res.content)['html'])('.theme') eq_(pq(themes[0]).attr('data-id'), '2') eq_(pq(themes[1]).attr('data-id'), '3')
def test_themes_more_data_id(self): """Check data-id of async'ed grabbed themes.""" req, themes = self.themes_more_helper() res = themes_more(req, flagged=self.flagged) themes = pq(json.loads(res.content)["html"])(".theme") eq_(pq(themes[0]).attr("data-id"), "2") eq_(pq(themes[1]).attr("data-id"), "3")
def test_themes_more_expired_data_id(self): """ Check data-id of async'ed grabbed themes, should ignore expired theme locks. """ req, themes = self.themes_more_helper() ThemeLock.objects.update(expiry=self.days_ago(1)) res = themes_more(req, flagged=self.flagged) themes = pq(json.loads(res.content)['html'])('.theme') eq_(pq(themes[0]).attr('data-id'), '0') eq_(pq(themes[1]).attr('data-id'), '1')