Merge lp:~diegosarmentero/ubuntuone-control-panel/not-shared-with-me into lp:ubuntuone-control-panel

Proposed by Diego Sarmentero on 2012-10-11
Status: Merged
Approved by: dobey on 2012-10-15
Approved revision: 366
Merged at revision: 365
Proposed branch: lp:~diegosarmentero/ubuntuone-control-panel/not-shared-with-me
Merge into: lp:ubuntuone-control-panel
Diff against target: 156 lines (+34/-24)
2 files modified
ubuntuone/controlpanel/gui/qt/share_links_search.py (+3/-2)
ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py (+31/-22)
To merge this branch: bzr merge lp:~diegosarmentero/ubuntuone-control-panel/not-shared-with-me
Reviewer Review Type Date Requested Status
Mike McCracken (community) Approve on 2012-10-11
Roberto Alsina (community) 2012-10-11 Approve on 2012-10-11
Review via email: mp+129284@code.launchpad.net

Commit Message

- Ignoring folders shared with me (LP: #1061949).

To post a comment you must log in.
366. By Diego Sarmentero on 2012-10-11

adding udf type to tests

Roberto Alsina (ralsina) wrote :

+1

review: Approve
Mike McCracken (mikemc) wrote :

works on darwin.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/controlpanel/gui/qt/share_links_search.py'
2--- ubuntuone/controlpanel/gui/qt/share_links_search.py 2012-09-28 20:27:46 +0000
3+++ ubuntuone/controlpanel/gui/qt/share_links_search.py 2012-10-11 19:55:24 +0000
4@@ -94,8 +94,9 @@
5 folders = []
6 for _, _, data in info:
7 for d in data:
8- folder = d.get('path', d.get('realpath'))
9- folders.append(folder)
10+ if d['type'] != 'SHARE':
11+ folder = d.get('path', d.get('realpath'))
12+ folders.append(folder)
13 self.get_folders_files(folders)
14
15 def get_folders_files(self, folders):
16
17=== modified file 'ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py'
18--- ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py 2012-09-28 18:50:03 +0000
19+++ ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py 2012-10-11 19:55:24 +0000
20@@ -82,8 +82,8 @@
21
22 def test_key_down_pressed(self):
23 """Check the proper actions are executed on key down pressed."""
24- data1 = [{'path': 'folder1'}]
25- data2 = [{'realpath': 'folder2'}]
26+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
27+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
28 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
29 self.ui.popup.list_widget.setCurrentRow(1)
30 current = self.ui.popup.list_widget.currentRow()
31@@ -99,8 +99,8 @@
32 data.append(True)
33
34 self.patch(self.ui.popup, "fetch_more", fake_fetch_more)
35- data1 = [{'path': 'folder1'}]
36- data2 = [{'realpath': 'folder2'}]
37+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
38+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
39 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2),
40 (0, 0, data1), (0, 0, data2), (0, 0, data1), (0, 0, data2),
41 (0, 0, data1), (0, 0, data2), (0, 0, data1), (0, 0, data2),
42@@ -114,8 +114,8 @@
43
44 def test_key_up_pressed(self):
45 """Check the proper actions are executed on key up pressed."""
46- data1 = [{'path': 'folder1'}]
47- data2 = [{'realpath': 'folder2'}]
48+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
49+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
50 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
51 self.ui.popup.list_widget.setCurrentRow(1)
52 current = self.ui.popup.list_widget.currentRow()
53@@ -124,8 +124,8 @@
54
55 def test_key_up_pressed_stay_in_0(self):
56 """Check the proper actions are executed on key up pressed."""
57- data1 = [{'path': 'folder1'}]
58- data2 = [{'realpath': 'folder2'}]
59+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
60+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
61 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
62 self.ui.popup.list_widget.setCurrentRow(0)
63 current = self.ui.popup.list_widget.currentRow()
64@@ -135,8 +135,8 @@
65
66 def test_key_return_pressed(self):
67 """Check the proper actions are executed on key return pressed."""
68- data1 = [{'path': 'folder1'}]
69- data2 = [{'realpath': 'folder2'}]
70+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
71+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
72 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
73 self.ui.popup.list_widget.setCurrentRow(1)
74 current = self.ui.popup.list_widget.currentRow()
75@@ -147,8 +147,8 @@
76
77 def test_mouse_click_pressed(self):
78 """Check the proper actions are executed when click is pressed."""
79- data1 = [{'path': 'folder1'}]
80- data2 = [{'realpath': 'folder2'}]
81+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
82+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
83 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
84 self.ui.popup.list_widget.setCurrentRow(1)
85 current = self.ui.popup.list_widget.currentItem()
86@@ -159,8 +159,8 @@
87
88 def test_mouse_scroll(self):
89 """Check that fetch_more is called when we reach the end of scroll."""
90- data1 = [{'path': 'folder1'}]
91- data2 = [{'realpath': 'folder2'}]
92+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
93+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
94 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
95 self.patch(self.ui.popup, "fetch_more", self._set_called)
96 self.ui._scroll_fetch_more(
97@@ -177,8 +177,8 @@
98 data.append(text)
99
100 self.patch(self.ui, "setText", fake_set_text)
101- data1 = [{'path': 'folder1'}]
102- data2 = [{'realpath': 'folder2'}]
103+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
104+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
105 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
106 self.ui.popup.list_widget.setCurrentRow(1)
107
108@@ -193,8 +193,8 @@
109
110 def test_process_volumes_info(self):
111 """Check that _process_volumes_info obtain the proper info."""
112- data1 = [{'path': 'folder1'}]
113- data2 = [{'realpath': 'folder2'}]
114+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
115+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
116 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
117 expected = [
118 os.path.join('other_path', 'test', 'qwe'),
119@@ -213,8 +213,8 @@
120 # _show_filter
121 # _get_filtered_list
122 self.patch(self.ui.popup, "isVisible", lambda: True)
123- data1 = [{'path': 'folder1'}]
124- data2 = [{'realpath': 'folder2'}]
125+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
126+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
127 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
128 self.ui.filter('p')
129 expected = [os.path.join('~', 'blabla', 'iop')]
130@@ -232,8 +232,8 @@
131 """Check the notification of the selected item."""
132 self.ui.itemSelected.connect(self._set_called)
133 self.patch(self.ui.popup, "isVisible", lambda: True)
134- data1 = [{'path': 'folder1'}]
135- data2 = [{'realpath': 'folder2'}]
136+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
137+ data2 = [{'realpath': 'folder2', 'type': 'UDF'}]
138 self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
139 self.ui.popup.list_widget.setCurrentRow(0)
140 item = self.ui.popup.list_widget.currentItem()
141@@ -242,6 +242,15 @@
142 ((os.path.join(u'other_path', u'test', u'qwe'),), {}))
143 self.assertEqual(self.ui.text(), '')
144
145+ def test_ignore_shared_folders(self):
146+ """Check that the folders shared with me are ignored."""
147+ data = []
148+ self.patch(self.ui, "get_folders_files", data.append)
149+ data1 = [{'path': 'folder1', 'type': 'ROOT'}]
150+ data2 = [{'realpath': 'folder2', 'type': 'SHARE'}]
151+ self.ui._process_volumes_info([(0, 0, data1), (0, 0, data2)])
152+ self.assertEqual(data, [['folder1']])
153+
154
155 class FileItemTestCase(BaseTestCase):
156 """Test the File Item."""

Subscribers

People subscribed via source and target branches