def test_update_rating_still_complete(self, complete_errs): self._rate_app() self.app.update(status=amo.STATUS_PENDING) eq_( _ratings_success_msg(self.app, amo.STATUS_PENDING, self.days_ago(5).isoformat()), _submission_msgs()["content_ratings_saved"], )
def _check_update_rating_msg(self, msg_mock): """ Had a rating before, updated the rating. In any case, should just say "Rating saved." msg. """ self.req.session = {'ratings_last_modified': self.days_ago(5)} self.app.content_ratings.create(ratings_body=0, rating=1) content_ratings(self.req, app_slug=self.app.app_slug) eq_(msg_mock.call_args[0][1], _submission_msgs()['content_ratings_saved'])
def test_success_msg_new_rating_complete(self, complete_mock, msg_mock): """ Did not have a rating before, has a rating now, and is fully complete. Should give a "Congratulations, your app is complete!". """ self._make_fully_complete(complete_mock) self.req.session = {'ratings_last_modified': None} self.app.content_ratings.create(ratings_body=0, rating=0) content_ratings(self.req, app_slug=self.app.app_slug) eq_(msg_mock.call_args[0][1], _submission_msgs()['complete'])
def test_success_msg_new_rating_not_complete(self, complete_mock, msg_mock): """ Did not have a rating before, has a rating now, but not fully complete. Should say "Rating saved." and display the "You need payments." msg. """ self._make_complete_except_payments(complete_mock) self.req.session = {'ratings_last_modified': None} self.app.content_ratings.create(ratings_body=0, rating=0) r = content_ratings(self.req, app_slug=self.app.app_slug) eq_(msg_mock.call_args[0][1], _submission_msgs()['content_ratings_saved']) # Need Payments message. msg = pq(r.content)('.notification-box').text() assert 'Payments' in msg
def test_success_msg_new_rating_not_complete(self, next_step_mock, msg_mock): """ Did not have a rating before, has a rating now, but not fully complete. Should say "Rating saved." and display the "You need payments." msg. """ next_step_mock.return_value = { 'name': 'Payments' } self.req.session = {'ratings_last_modified': None} self.app.update(status=amo.STATUS_NULL) self.app.content_ratings.create(ratings_body=0, rating=0) r = content_ratings(self.req, app_slug=self.app.app_slug) eq_(msg_mock.call_args[0][1], _submission_msgs()['content_ratings_saved']) # Need Payments message. msg = pq(r.content)('.notification-box').text() assert 'Payments' in msg
def test_create_rating_public_app(self, complete_errs): self._rate_app() self.app.update(status=amo.STATUS_PUBLIC) eq_(_ratings_success_msg(self.app, amo.STATUS_PUBLIC, None), _submission_msgs()["content_ratings_saved"])
def test_create_rating_now_complete(self, complete_errs): self._rate_app() self.app.update(status=amo.STATUS_PENDING) eq_(_ratings_success_msg(self.app, amo.STATUS_NULL, None), _submission_msgs()["complete"])
def test_create_rating_still_incomplete(self): self._rate_app() eq_(_ratings_success_msg(self.app, amo.STATUS_NULL, None), _submission_msgs()["content_ratings_saved"])