Merge lp:~verterok/ubuntuone-client/u1sdtool_fix_list-folders_subscribed into lp:ubuntuone-client

Proposed by Guillermo Gonzalez
Status: Merged
Approved by: Roman Yepishev
Approved revision: 609
Merge reported by: Guillermo Gonzalez
Merged at revision: not available
Proposed branch: lp:~verterok/ubuntuone-client/u1sdtool_fix_list-folders_subscribed
Merge into: lp:ubuntuone-client
Diff against target: 60 lines (+24/-10)
2 files modified
tests/syncdaemon/test_u1sdtool.py (+22/-9)
ubuntuone/syncdaemon/tools.py (+2/-1)
To merge this branch: bzr merge lp:~verterok/ubuntuone-client/u1sdtool_fix_list-folders_subscribed
Reviewer Review Type Date Requested Status
Roman Yepishev (community) Approve
Review via email: mp+31583@code.launchpad.net

Commit message

Fix u1sdtool --list-folders to correctly show unsubscribed status.

Description of the change

This branch fix u1sdtool --list-folders to correctly show unsubscribed status.

To post a comment you must log in.
Revision history for this message
Roman Yepishev (rye) wrote :

Tested by listing my folders:
Folder list:
  id=20b0b044-523f-462a-8938-7e2fa16030b0 subscribed=False path=/home/rtg/Public
  id=a19bb966-a0e9-4f05-a927-f9fc81986258 subscribed=True path=/home/rtg/.ubuntuone/Purchased from Ubuntu One
  id=5577d808-6a3f-4873-8b27-1fd644bd7e20 subscribed=True path=/home/rtg/Documents

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/syncdaemon/test_u1sdtool.py'
2--- tests/syncdaemon/test_u1sdtool.py 2010-07-29 19:34:35 +0000
3+++ tests/syncdaemon/test_u1sdtool.py 2010-08-02 21:09:43 +0000
4@@ -301,8 +301,8 @@
5 return d
6
7 @defer.inlineCallbacks
8- def test_show_folders(self):
9- """test the output of --list-folders """
10+ def test_show_folders_subscribed(self):
11+ """Test the output of --list-folders."""
12 out = StringIO()
13 path = u'ñoño'.encode('utf-8')
14 suggested_path = os.path.join("~", u'ñoño')
15@@ -312,13 +312,26 @@
16 yield self.main.vm.add_udf(udf)
17 expected = u"Folder list:\n id=folder_id subscribed=True " + \
18 u"path=\xf1o\xf1o\n"
19- d = self.tool.get_folders()
20- d.addCallback(lambda result: show_folders(result, out))
21- def check(result):
22- """check the output"""
23- self.assertEquals(out.getvalue(), expected)
24- d.addCallback(check)
25- yield d
26+ result = yield self.tool.get_folders()
27+ show_folders(result, out)
28+ self.assertEquals(out.getvalue(), expected)
29+
30+ @defer.inlineCallbacks
31+ def test_show_folders_unsubscribed(self):
32+ """Test the output of --list-folders with a unsubscribed folder."""
33+ out = StringIO()
34+ path = u'ñoño'.encode('utf-8')
35+ suggested_path = os.path.join("~", u'ñoño')
36+
37+ udf = UDF("folder_id", "node_id", suggested_path, path,
38+ subscribed=True)
39+ yield self.main.vm.add_udf(udf)
40+ self.main.vm.unsubscribe_udf(udf.id)
41+ expected = u"Folder list:\n id=folder_id subscribed=False " + \
42+ u"path=\xf1o\xf1o\n"
43+ result = yield self.tool.get_folders()
44+ show_folders(result, out)
45+ self.assertEquals(out.getvalue(), expected)
46
47 @defer.inlineCallbacks
48 def generic_show_dirty_nodes(self, encoding, empty=False):
49
50=== modified file 'ubuntuone/syncdaemon/tools.py'
51--- ubuntuone/syncdaemon/tools.py 2010-07-29 19:34:15 +0000
52+++ ubuntuone/syncdaemon/tools.py 2010-08-02 21:09:43 +0000
53@@ -793,7 +793,8 @@
54 out.write("Folder list:\n")
55 for folder in folders:
56 msg_template = ' id=%s subscribed=%s path=%s\n'
57- out.write(msg_template % (folder['volume_id'], folder['subscribed'],
58+ out.write(msg_template % (folder['volume_id'],
59+ bool(folder['subscribed']),
60 folder['path']))
61
62

Subscribers

People subscribed via source and target branches