Example #1
0
    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'])
Example #2
0
    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'])
Example #3
0
    def test_summary(self):
        rbs = mkt.ratingsbodies
        ratings = [rbs.CLASSIND_L, rbs.GENERIC_3, rbs.USK_18, rbs.ESRB_M, rbs.PEGI_12]
        for rating in ratings:
            ContentRating.objects.create(addon=self.app, ratings_body=rating.ratingsbody.id, rating=rating.id)

        r = content_ratings(self.req, app_slug=self.app.app_slug)
        doc = pq(r.content)

        for i, name in enumerate(doc(".name")):
            eq_(name.text, ratings[i].ratingsbody.name)
Example #4
0
    def test_summary(self):
        rbs = mkt.ratingsbodies
        ratings = [rbs.CLASSIND_L, rbs.GENERIC_3, rbs.USK_18, rbs.ESRB_M,
                   rbs.PEGI_12]
        for rating in ratings:
            ContentRating.objects.create(
                addon=self.app, ratings_body=rating.ratingsbody.id,
                rating=rating.id)

        r = content_ratings(self.req, app_slug=self.app.app_slug)
        doc = pq(r.content)

        for i, name in enumerate(doc('.name')):
            eq_(name.text, ratings[i].ratingsbody.name)
Example #5
0
    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
Example #6
0
    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