Merge lp:~diegosarmentero/ubuntuone-client/publish-file into lp:ubuntuone-client

Proposed by Diego Sarmentero on 2012-05-30
Status: Merged
Approved by: Mike McCracken on 2012-05-30
Approved revision: 1251
Merged at revision: 1251
Proposed branch: lp:~diegosarmentero/ubuntuone-client/publish-file
Merge into: lp:ubuntuone-client
Diff against target: 57 lines (+33/-3)
2 files modified
tests/platform/test_tools.py (+30/-0)
ubuntuone/platform/tools/__init__.py (+3/-3)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-client/publish-file
Reviewer Review Type Date Requested Status
Mike McCracken (community) Approve on 2012-05-30
Roberto Alsina (community) 2012-05-30 Approve on 2012-05-30
Review via email: mp+107996@code.launchpad.net

Commit Message

- Decoding path for comparison (LP: #998079).

To post a comment you must log in.
Roberto Alsina (ralsina) :
review: Approve
Mike McCracken (mikemc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/platform/test_tools.py'
2--- tests/platform/test_tools.py 2012-04-09 20:07:05 +0000
3+++ tests/platform/test_tools.py 2012-05-30 15:42:25 +0000
4@@ -691,6 +691,36 @@
5 self.assertEqual('http://example.com', file_info['public_url'])
6
7 @defer.inlineCallbacks
8+ def test_change_public_access_with_unicode(self):
9+ """Test change_public_access."""
10+ # XXX: change public access is the only class that expects uuid's as
11+ # params this may indicate that we need to refactor that class to be
12+ # consistent with the rest of syncdaemon where ID's are always strings
13+ node_id = '59809aae-9c5a-47e0-b37c-5abbfbe7c50a'
14+ share_id = ""
15+ path = os.path.join(self.root_dir, u"ñoño")
16+ path = path.encode('utf-8')
17+ self.fs.create(path, "")
18+ self.fs.set_node_id(path, node_id)
19+
20+ def change_public_access(share_id, node_id, is_public):
21+ """Fake change_public_access"""
22+ self.main.event_q.push("AQ_CHANGE_PUBLIC_ACCESS_OK",
23+ share_id=share_id, node_id=node_id,
24+ is_public=True,
25+ public_url='http://example.com')
26+ self.patch(self.main.action_q, 'change_public_access',
27+ change_public_access)
28+
29+ file_info = yield self.tool.change_public_access(path, True)
30+
31+ self.assertEqual(path.decode('utf-8'), file_info['path'])
32+ self.assertEqual(share_id, file_info['share_id'])
33+ self.assertEqual(node_id, file_info['node_id'])
34+ self.assertEqual('True', file_info['is_public'])
35+ self.assertEqual('http://example.com', file_info['public_url'])
36+
37+ @defer.inlineCallbacks
38 def test_get_public_files(self):
39 """Get the public files."""
40 node_id = '59809aae-9c5a-47e0-b37c-5abbfbe7c50a'
41
42=== modified file 'ubuntuone/platform/tools/__init__.py'
43--- ubuntuone/platform/tools/__init__.py 2012-05-24 09:43:19 +0000
44+++ ubuntuone/platform/tools/__init__.py 2012-05-30 15:42:25 +0000
45@@ -480,9 +480,9 @@
46 def change_public_access(self, path, is_public):
47 """Change the public access for a given path."""
48 d = self.wait_for_signals(
49- 'PublicAccessChanged', 'PublicAccessChangeError',
50- success_filter=lambda info: info['path'] == path,
51- error_filter=lambda info, _: info['path'] == path)
52+ 'PublicAccessChanged', 'PublicAccessChangeError',
53+ success_filter=lambda info: info['path'] == path.decode('utf-8'),
54+ error_filter=lambda info, _: info['path'] == path.decode('utf-8'))
55
56 metadata = yield self.get_metadata(path)
57 args = (metadata['share_id'], metadata['node_id'], is_public)

Subscribers

People subscribed via source and target branches