Merge lp://qastaging/~diegosarmentero/ubuntuone-control-panel/tab-shares-functions into lp://qastaging/ubuntuone-control-panel

Proposed by Diego Sarmentero
Status: Merged
Approved by: Roberto Alsina
Approved revision: 363
Merged at revision: 352
Proposed branch: lp://qastaging/~diegosarmentero/ubuntuone-control-panel/tab-shares-functions
Merge into: lp://qastaging/ubuntuone-control-panel
Diff against target: 2027 lines (+1644/-41)
17 files modified
data/qt/images.qrc (+1/-0)
data/qt/share_file.ui (+94/-0)
data/qt/share_links.ui (+196/-10)
data/qt/ubuntuone.qss (+61/-0)
ubuntuone/controlpanel/backend.py (+36/-1)
ubuntuone/controlpanel/gui/__init__.py (+2/-0)
ubuntuone/controlpanel/gui/qt/share_file.py (+63/-0)
ubuntuone/controlpanel/gui/qt/share_links.py (+189/-1)
ubuntuone/controlpanel/gui/qt/share_links_search.py (+318/-0)
ubuntuone/controlpanel/gui/qt/tests/__init__.py (+18/-0)
ubuntuone/controlpanel/gui/qt/tests/test_share_file.py (+76/-0)
ubuntuone/controlpanel/gui/qt/tests/test_share_links.py (+161/-3)
ubuntuone/controlpanel/gui/qt/tests/test_share_links_search.py (+302/-0)
ubuntuone/controlpanel/gui/qt/tests/test_systray.py (+15/-26)
ubuntuone/controlpanel/sd_client/__init__.py (+20/-0)
ubuntuone/controlpanel/tests/test_backend.py (+64/-0)
ubuntuone/controlpanel/tests/test_sd_client.py (+28/-0)
To merge this branch: bzr merge lp://qastaging/~diegosarmentero/ubuntuone-control-panel/tab-shares-functions
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Alejandro J. Cura (community) Approve
Review via email: mp+121283@code.qastaging.launchpad.net

Commit message

- Adding functionality to the Share Links Tab (LP: #1039142).

To post a comment you must log in.
Revision history for this message
Alejandro J. Cura (alecu) wrote :

This is a huge branch, that could have been split in at least three branches. :-(

Please fix the commented lines in the last three testcases.
Does this need a freeze exception?

review: Needs Fixing
352. By Diego Sarmentero

fixing docstrings

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

> This is a huge branch, that could have been split in at least three branches.
> :-(

I know, we talk about the length of the branch with ralsina on friday.
A lot of parts are really trivial, comment, qss, xml and docstring anyway...

>
> Please fix the commented lines in the last three testcases.
> Does this need a freeze exception?

Docstrings fixed.

353. By Diego Sarmentero

retrieving folders data asynchronously

Revision history for this message
Alejandro J. Cura (alecu) wrote :

Some comments so far:

5 docstrings are copypasted with: """Obtain the data to create the sync menu."""
Please make them unique.
---
There's an extra blank line after "class ShareLinksPanel" and its docstring.

354. By Diego Sarmentero

enhanced line button updated

Revision history for this message
Alejandro J. Cura (alecu) wrote :

Let's move all QLabel font sizes and color styles used in <span>s into one file with all styling constants.
This is not blocking for this branch, so a new bug is being opened.

---

Empty lines before the docstrings in class ActionsButtons and class EnhancedLineEdit.

----

It's never a good idea to touch class variables in tests, because the state of the class variable is not resetted between tests. Please use regular instances for the fake objects instead every time you can, something like:

class FakeDesktopService(object):
    """Fake QDesktopService."""

    def __init__(self):
        self.opened_url = None

    def openUrl(self, url):
        """Fake openUrl."""
        self.opened_url = url

[...]

    def test_open_in_browser(self):
        """Test the execution of open_in_browser."""
        fake_desktop_service = FakeDesktopService()
        self.patch(QtGui, "QDesktopServices", fake_desktop_service)
        url = 'http://ubuntuone.com/asd123'
        self.ui.ui.line_copy_link.setText(url)
        self.ui._open_in_browser()
        expected = QtCore.QUrl(url)
        self.assertEqual(expected, fake_desktop_service.opened_url)

And similarly in the two tests in ActionsButtonsTestCase.

----

Please, fix the docstrings in:
 * test_move_to_main_list
 * test_get_public_files
 * test_copy

review: Needs Fixing
355. By Diego Sarmentero

tests fixed

356. By Diego Sarmentero

fixing docstring

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

> Let's move all QLabel font sizes and color styles used in <span>s into one
> file with all styling constants.
> This is not blocking for this branch, so a new bug is being opened.
>

I've created a different bug for this:
https://bugs.launchpad.net/ubuntuone-control-panel/+bug/1042228

> ---
>
> Empty lines before the docstrings in class ActionsButtons and class
> EnhancedLineEdit.
>
> ----
>
> It's never a good idea to touch class variables in tests, because the state of
> the class variable is not resetted between tests. Please use regular instances
> for the fake objects instead every time you can, something like:
>
> class FakeDesktopService(object):
> """Fake QDesktopService."""
>
> def __init__(self):
> self.opened_url = None
>
> def openUrl(self, url):
> """Fake openUrl."""
> self.opened_url = url
>
> [...]
>
> def test_open_in_browser(self):
> """Test the execution of open_in_browser."""
> fake_desktop_service = FakeDesktopService()
> self.patch(QtGui, "QDesktopServices", fake_desktop_service)
> url = 'http://ubuntuone.com/asd123'
> self.ui.ui.line_copy_link.setText(url)
> self.ui._open_in_browser()
> expected = QtCore.QUrl(url)
> self.assertEqual(expected, fake_desktop_service.opened_url)
>
>
> And similarly in the two tests in ActionsButtonsTestCase.
>
> ----
>
> Please, fix the docstrings in:
> * test_move_to_main_list
> * test_get_public_files
> * test_copy

Fixed

Revision history for this message
Alejandro J. Cura (alecu) wrote :

There are no tests for keyPressEvent and moveEvent in SearchBox.
And also keyPressEvent could benefit from being refactored into smaller functions that are more easily testable.

----

The UI completely freezes for about 15 seconds when starting. The window manager even dims it, as it does with unresponsive windows.

This does not happen on trunk.

----

Besides the above two issues, all tests pass and the code looks good so far.

review: Needs Fixing
357. By Diego Sarmentero

FakeDesktopService improved

358. By Diego Sarmentero

fixing memory and performance issues

359. By Diego Sarmentero

tests fixed

Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

> There are no tests for keyPressEvent and moveEvent in SearchBox.
> And also keyPressEvent could benefit from being refactored into smaller
> functions that are more easily testable.
>
> ----
>
> The UI completely freezes for about 15 seconds when starting. The window
> manager even dims it, as it does with unresponsive windows.
>
> This does not happen on trunk.
>
> ----
>
> Besides the above two issues, all tests pass and the code looks good so far.

Fixed

360. By Diego Sarmentero

deleting legacy code

361. By Diego Sarmentero

adding missing docstring

362. By Diego Sarmentero

fixed docstrings

Revision history for this message
Alejandro J. Cura (alecu) wrote :

There are "ifs" in _key_down_pressed and _key_up_pressed, but there's only one test for each.
Please add more tests that check all possible combinations.

----

There's no need for this to be a dict:
    self.fake_desktop_service.data['url']

It should be just a variable:
    self.fake_desktop_service.opened_url

review: Needs Fixing
Revision history for this message
Roberto Alsina (ralsina) wrote :

I get this backtrace:

Traceback (most recent call last):
  File "/home/ralsina/canonical/shares/ubuntuone/controlpanel/gui/qt/share_links_search.py", line 296, in run
    folders_data += self.get_folder_info(folder)
  File "/home/ralsina/canonical/shares/ubuntuone/controlpanel/gui/qt/share_links_search.py", line 316, in get_folder_info
    for root, _, files in os.walk(folder):
  File "/usr/lib/python2.7/os.py", line 294, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/usr/lib/python2.7/os.py", line 284, in walk
    if isdir(join(top, name)):
  File "/usr/lib/python2.7/posixpath.py", line 71, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 17: ordinal not in range(128)

review: Needs Fixing
Revision history for this message
Diego Sarmentero (diegosarmentero) wrote :

> There are "ifs" in _key_down_pressed and _key_up_pressed, but there's only
> one test for each.
> Please add more tests that check all possible combinations.
>
> ----
>
> There's no need for this to be a dict:
> self.fake_desktop_service.data['url']
>
> It should be just a variable:
> self.fake_desktop_service.opened_url

Fixed

363. By Diego Sarmentero

tests improved

Revision history for this message
Roberto Alsina (ralsina) wrote :

> I get this backtrace:
>
>
> Traceback (most recent call last):
> File "/home/ralsina/canonical/shares/ubuntuone/controlpanel/gui/qt/share_lin
> ks_search.py", line 296, in run
> folders_data += self.get_folder_info(folder)
> File "/home/ralsina/canonical/shares/ubuntuone/controlpanel/gui/qt/share_lin
> ks_search.py", line 316, in get_folder_info
> for root, _, files in os.walk(folder):
> File "/usr/lib/python2.7/os.py", line 294, in walk
> for x in walk(new_path, topdown, onerror, followlinks):
> File "/usr/lib/python2.7/os.py", line 284, in walk
> if isdir(join(top, name)):
> File "/usr/lib/python2.7/posixpath.py", line 71, in join
> path += '/' + b
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xf1 in position 17:
> ordinal not in range(128)

This was caused by files with invalid utf-8 names, which is not as critical. Removing this needsfixing.

Revision history for this message
Roberto Alsina (ralsina) wrote :

The search box doesn't let you type spaces.

review: Needs Fixing
Revision history for this message
Alejandro J. Cura (alecu) wrote :

+1

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

Removing objections, created separate bugs for them

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches