18
18
class TestPurchase(unittest.TestCase):
20
def test_purchase_view_log_cleaner(self):
21
win = get_test_window_purchaseview()
22
self.addCleanup(win.destroy)
23
do_events_with_sleep()
25
view = win.get_data("view")
27
purchaseview.LOG = mock = Mock()
28
# run a "harmless" log message and ensure its logged normally
29
view.wk.webkit.execute_script('console.log("foo")')
30
self.assertTrue("foo" in mock.debug.call_args[0][0])
33
# run a message that contains token info
34
s = ('http://sca.razorgirl.info/subscriptions/19077/checkout_complete/'
35
' @10: {"token_key": "hiddenXXXXXXXXXX", "consumer_secret": '
36
'"hiddenXXXXXXXXXXXX", "api_version": 2.0, "subscription_id": '
37
'19077, "consumer_key": "rKhNPBw", "token_secret": '
38
'"hiddenXXXXXXXXXXXXXXX"}')
39
view.wk.webkit.execute_script("console.log('%s')" % s)
40
self.assertTrue("skipping" in mock.debug.call_args[0][0])
41
self.assertFalse("consumer_secret" in mock.debug.call_args[0][0])
44
20
def test_purchase_view_tos(self):
45
21
win = get_test_window_purchaseview()
46
22
self.addCleanup(win.destroy)