def test_submit_review(self, mock_submit_review):
        mock_submit_review.return_value = ReviewDetails.from_dict(
            {'foo': 'bar'})
        review = self.make_review()

        self.api.submit_review(review)

        self.wait_for_worker()
        self.assertTrue(mock_submit_review.called)
        review_arg = mock_submit_review.call_args[1]['review']
        self.assertEqual(review.text, review_arg.review_text)
示例#2
0
    def test_submit_review(self, mock_submit_review):
        mock_submit_review.return_value = ReviewDetails.from_dict(
            {'foo': 'bar'})
        review = self.make_review()

        self.api.submit_review(review)

        self.wait_for_worker()
        self.assertTrue(mock_submit_review.called)
        review_arg = mock_submit_review.call_args[1]['review']
        self.assertEqual(review.text, review_arg.review_text)
 def _on_submit_review_data(self, spawn_helper, review_json, app, callback):
     """ called when submit_review finished, when the review was send
         successfully the callback is triggered with the new reviews
     """
     LOG.debug("_on_submit_review_data")
     # read stdout from submit_review
     review = ReviewDetails.from_dict(review_json)
     # FIXME: ideally this would be stored in ubuntu-sso-client
     #        but it dosn't so we store it here
     save_person_to_config(review.reviewer_username)
     if not app in self._reviews:
         self._reviews[app] = []
     self._reviews[app].insert(0, Review.from_piston_mini_client(review))
     callback(app, self._reviews[app])
示例#4
0
文件: rnr.py 项目: pombredanne/shop
 def _on_modify_review_finished(self, spawn_helper, review_json, review_id):
     """called when modify_review finished"""
     LOG.debug("_on_modify_review_finished")
     #review_json = spawn_helper._stdout
     mod_review = ReviewDetails.from_dict(review_json)
     for (app, reviews) in self._reviews.items():
         for review in reviews:
             if str(review.id) == str(review_id):
                 # remove the one we don't want to see anymore
                 self._reviews[app].remove(review)
                 new_review = Review.from_piston_mini_client(mod_review)
                 self._reviews[app].insert(0, new_review)
                 self.emit("replace-review", app, new_review)
                 break
示例#5
0
文件: rnr.py 项目: pombredanne/shop
 def _on_submit_review_data(self, spawn_helper, review_json, app):
     """ called when submit_review finished, when the review was send
         successfully the callback is triggered with the new reviews
     """
     LOG.debug("_on_submit_review_data")
     # read stdout from submit_review
     review = ReviewDetails.from_dict(review_json)
     # FIXME: ideally this would be stored in ubuntu-sso-client
     #        but it doesn't so we store it here
     save_person_to_config(review.reviewer_username)
     if not app in self._reviews:
         self._reviews[app] = []
     self._reviews[app].insert(0, Review.from_piston_mini_client(review))
     self.emit("get-reviews-finished", app, self._reviews[app])
示例#6
0
文件: rnr.py 项目: sti-lyneos/shop
 def _on_modify_review_finished(self, spawn_helper, review_json, review_id):
     """called when modify_review finished"""
     LOG.debug("_on_modify_review_finished")
     #review_json = spawn_helper._stdout
     mod_review = ReviewDetails.from_dict(review_json)
     for (app, reviews) in self._reviews.items():
         for review in reviews:
             if str(review.id) == str(review_id):
                 # remove the one we don't want to see anymore
                 self._reviews[app].remove(review)
                 new_review = Review.from_piston_mini_client(mod_review)
                 self._reviews[app].insert(0, new_review)
                 self.emit("replace-review", app, new_review)
                 break
    def test_modify_review(self, mock_modify_review):
        mock_modify_review.return_value = ReviewDetails.from_dict(
            {'foo': 'bar'})
        review = {
            'summary': 'Cool',
            'review_text': 'Super awesome app!',
            'rating': 4,
        }

        self.api.modify_review(1234, review)

        self.wait_for_worker()
        self.assertTrue(mock_modify_review.called)
        self.assertEqual(1234, mock_modify_review.call_args[1]['review_id'])
        self.assertEqual(4, mock_modify_review.call_args[1]['rating'])
        self.assertEqual('Cool', mock_modify_review.call_args[1]['summary'])
示例#8
0
    def test_modify_review(self, mock_modify_review):
        mock_modify_review.return_value = ReviewDetails.from_dict(
            {'foo': 'bar'})
        review = {
            'summary': 'Cool',
            'review_text': 'Super awesome app!',
            'rating': 4,
        }

        self.api.modify_review(1234, review)

        self.wait_for_worker()
        self.assertTrue(mock_modify_review.called)
        self.assertEqual(1234, mock_modify_review.call_args[1]['review_id'])
        self.assertEqual(4, mock_modify_review.call_args[1]['rating'])
        self.assertEqual('Cool', mock_modify_review.call_args[1]['summary'])