Code review comment for lp://qastaging/~diegosarmentero/ubuntuone-control-panel/tab-shares-functions

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

« Back to merge proposal