def test_edit_review_screen_has_right_labels(self):
        """Check that LP #880255 stays fixed. """

        review_app = SubmitReviewsApp(datadir="../data",
                                      app=None,
                                      parent_xid='',
                                      iconname='accessories-calculator',
                                      origin=None,
                                      version=None,
                                      action='modify',
                                      review_id=10000)
        # monkey patch away login to avoid that we actually login
        # and the UI changes because of that

        review_app.login = lambda: True

        # run the main app
        review_app.run()

        self._p()
        review_app.login_successful('foobar')
        self._p()
        self.assertEqual(_('Rating:'), review_app.rating_label.get_label())
        self.assertEqual(_('Summary:'),
                         review_app.review_summary_label.get_label())
        self.assertEqual(
            _('Review by: %s') % 'foobar', review_app.review_label.get_label())
        review_app.submit_window.hide()
Пример #2
0
    def test_change_status(self):
        review_app = SubmitReviewsApp(datadir="../data", app=None,
            parent_xid='', iconname='accessories-calculator', origin=None,
            version=None, action='nothing')
        msg = 'Something completely different'
        cases = {'clear': (True, True, True, True, None, None),
                 'progress': (False, True, True, True, msg, None),
                 'fail': (True, False, True, True, None, msg),
                 'success': (True, True, False, True, msg, None),
                 'warning': (True, True, True, False, msg, None),
                }
        review_app.run()

        for status in cases:
            review_app._change_status(status, msg)
            spinner, error, success, warn, label, error_detail = cases[status]
            self.assertEqual(spinner,
                review_app.submit_spinner.get_parent() is None)
            self.assertEqual(error,
                review_app.submit_error_img.get_window() is None)
            self.assertEqual(success,
                review_app.submit_success_img.get_window() is None)
            self.assertEqual(warn,
                review_app.submit_warn_img.get_window() is None)
            if label:
                self.assertEqual(label,
                    review_app.label_transmit_status.get_text())
            if error_detail:
                buff = review_app.error_textview.get_buffer()
                self.assertEqual(error_detail,
                    buff.get_text(buff.get_start_iter(), buff.get_end_iter(),
                    include_hidden_chars=False))
                review_app.detail_expander.get_visible()
    def test_change_status(self):
        review_app = SubmitReviewsApp(datadir="../data",
                                      app=None,
                                      parent_xid='',
                                      iconname='accessories-calculator',
                                      origin=None,
                                      version=None,
                                      action='nothing')
        msg = 'Something completely different'
        cases = {
            'clear': (True, True, True, True, None, None),
            'progress': (False, True, True, True, msg, None),
            'fail': (True, False, True, True, None, msg),
            'success': (True, True, False, True, msg, None),
            'warning': (True, True, True, False, msg, None),
        }
        review_app.run()

        for status in cases:
            review_app._change_status(status, msg)
            spinner, error, success, warn, label, error_detail = cases[status]
            self.assertEqual(spinner,
                             review_app.submit_spinner.get_parent() is None)
            self.assertEqual(error,
                             review_app.submit_error_img.get_window() is None)
            self.assertEqual(
                success,
                review_app.submit_success_img.get_window() is None)
            self.assertEqual(warn,
                             review_app.submit_warn_img.get_window() is None)
            if label:
                self.assertEqual(label,
                                 review_app.label_transmit_status.get_text())
            if error_detail:
                buff = review_app.error_textview.get_buffer()
                self.assertEqual(
                    error_detail,
                    buff.get_text(buff.get_start_iter(),
                                  buff.get_end_iter(),
                                  include_hidden_chars=False))
                review_app.detail_expander.get_visible()
Пример #4
0
    def test_edit_review_screen_has_right_labels(self):
        """Check that LP #880255 stays fixed. """

        review_app = SubmitReviewsApp(datadir="../data", app=None,
            parent_xid='', iconname='accessories-calculator', origin=None,
            version=None, action='modify', review_id=10000)
        # monkey patch away login to avoid that we actually login
        # and the UI changes because of that

        review_app.login = lambda: True

        # run the main app
        review_app.run()

        self._p()
        review_app.login_successful('foobar')
        self._p()
        self.assertEqual(_('Rating:'), review_app.rating_label.get_label())
        self.assertEqual(_('Summary:'),
            review_app.review_summary_label.get_label())
        self.assertEqual(_('Review by: %s') % 'foobar',
            review_app.review_label.get_label())
        review_app.submit_window.hide()
        if options.debug:
            logging.basicConfig(level=logging.DEBUG)

        # personality
        logging.debug("submit_review mode")

        # initialize and run
        theapp = Application(options.appname, options.pkgname)
        review_app = SubmitReviewsApp(datadir=options.datadir,
                                      app=theapp,
                                      parent_xid=options.parent_xid,
                                      iconname=options.iconname,
                                      origin=options.origin,
                                      version=options.version)
        review_app.run()

    # run "report" personality
    if "report_review" in sys.argv[0]:
        # check options
        parser.add_option("", "--review-id")
        parser.add_option("", "--parent-xid")
        parser.add_option("", "--debug", action="store_true", default=False)
        (options, args) = parser.parse_args()

        softwarecenter.paths.datadir = options.datadir

        if not (options.review_id):
            parser.error(_("Missing review-id arguments"))

        if options.debug:
Пример #6
0
        if options.debug:
            logging.basicConfig(level=logging.DEBUG)

        # personality
        logging.debug("submit_review mode")

        # initialize and run
        theapp = Application(options.appname, options.pkgname)
        review_app = SubmitReviewsApp(datadir=options.datadir,
                                      app=theapp,
                                      parent_xid=options.parent_xid,
                                      iconname=options.iconname,
                                      origin=options.origin,
                                      version=options.version)
        review_app.run()

    # run "report" personality
    if "report_review" in sys.argv[0]:
        # check options
        parser.add_option("", "--review-id") 
        parser.add_option("", "--parent-xid")
        parser.add_option("", "--debug",
                          action="store_true", default=False)
        (options, args) = parser.parse_args()

        softwarecenter.paths.datadir = options.datadir

        if not (options.review_id):
            parser.error(_("Missing review-id arguments"))