Merge lp:~alecu/ubuntuone-control-panel/mock-timestamp into lp:ubuntuone-control-panel

Proposed by Alejandro J. Cura on 2013-05-31
Status: Merged
Approved by: dobey on 2013-05-31
Approved revision: 404
Merged at revision: 404
Proposed branch: lp:~alecu/ubuntuone-control-panel/mock-timestamp
Merge into: lp:ubuntuone-control-panel
Diff against target: 25 lines (+6/-0)
1 file modified
ubuntuone/controlpanel/tests/test_web_client.py (+6/-0)
To merge this branch: bzr merge lp:~alecu/ubuntuone-control-panel/mock-timestamp
Reviewer Review Type Date Requested Status
dobey (community) 2013-05-31 Approve on 2013-05-31
Review via email: mp+166856@code.launchpad.net

Commit message

- Force a fake timestamp for the webclient tests (LP:#1186294).

Description of the change

- Force a fake timestamp for the webclient tests (LP:#1186294).

To post a comment you must log in.
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/tests/test_web_client.py'
2--- ubuntuone/controlpanel/tests/test_web_client.py 2013-02-22 19:54:41 +0000
3+++ ubuntuone/controlpanel/tests/test_web_client.py 2013-05-31 16:51:27 +0000
4@@ -52,6 +52,7 @@
5 'oauth_signature_method=HMAC-SHA1&next=%%2Fblah&oauth_version=1.0&' \
6 'oauth_token=%s&oauth_signature=s6h0LRBiWchTADrTJWaJUSuaGpo3D' % \
7 (SAMPLE_CREDENTIALS['consumer_key'], SAMPLE_CREDENTIALS['token'])
8+FAKE_TIMESTAMP = 1
9
10
11 def sample_get_credentials():
12@@ -108,8 +109,13 @@
13 self.base_iri = self.ws.get_iri()
14
15 self.wc = WebClient(sample_get_credentials, base_url=self.base_iri)
16+ self.patch(self.wc.wc, "get_timestamp", self.fake_get_timestamp)
17 self.addCleanup(self.wc.shutdown)
18
19+ def fake_get_timestamp(self):
20+ """A fake get_timestamp."""
21+ return defer.succeed(FAKE_TIMESTAMP)
22+
23 def test_correct_app_name(self):
24 """Assert that the wc uses the correct appname."""
25 self.assertEqual(APP_NAME, self.wc.wc.appname)

Subscribers

People subscribed via source and target branches