~mmcg069/software-center/Bug846204

« back to all changes in this revision

Viewing changes to test/gtk3/test_purchase.py

  • Committer: Matthew McGowan
  • Date: 2011-09-20 20:53:11 UTC
  • mfrom: (2362.10.2 trunk)
  • mto: This revision was merged to the branch mainline in revision 2397.
  • Revision ID: matthew.joseph.mcgowan@gmail.com-20110920205311-lrdoiz3l4su2wu44
merge w trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
class TestPurchase(unittest.TestCase):
25
25
 
 
26
    def test_purchase_view_log_cleaner(self):
 
27
        import softwarecenter.ui.gtk3.views.purchaseview
 
28
        from softwarecenter.ui.gtk3.views.purchaseview import get_test_window_purchaseview
 
29
        win = get_test_window_purchaseview()
 
30
        self._p()
 
31
        # get the view
 
32
        view = win.get_data("view")
 
33
        # install the mock
 
34
        softwarecenter.ui.gtk3.views.purchaseview.LOG = mock = Mock()
 
35
        # run a "harmless" log message and ensure its logged normally
 
36
        view.wk.webkit.execute_script('console.log("foo")')
 
37
        self.assertTrue("foo" in mock.debug.call_args[0][0])
 
38
        mock.reset_mock()
 
39
 
 
40
        # run a message that contains token info
 
41
        s = 'http://sca.razorgirl.info/subscriptions/19077/checkout_complete/ @10: {"token_key": "hiddenXXXXXXXXXX", "consumer_secret": "hiddenXXXXXXXXXXXX", "api_version": 2.0, "subscription_id": 19077, "consumer_key": "rKhNPBw", "token_secret": "hiddenXXXXXXXXXXXXXXX"}'
 
42
        view.wk.webkit.execute_script("console.log('%s')" % s)
 
43
        self.assertTrue("skipping" in mock.debug.call_args[0][0])
 
44
        self.assertFalse("consumer_secret" in mock.debug.call_args[0][0])
 
45
        mock.reset_mock()
 
46
        
 
47
        # run another one
 
48
        win.destroy()
 
49
 
 
50
 
26
51
    def test_reinstall_previous_purchase_display(self):
27
52
        os.environ["PYTHONPATH"]=".."
28
53
        mock_options = Mock()