Merge lp:~laney/ubuntu-system-settings/fix-tests into lp:ubuntu-system-settings

Proposed by Iain Lane
Status: Merged
Merged at revision: 682
Proposed branch: lp:~laney/ubuntu-system-settings/fix-tests
Merge into: lp:ubuntu-system-settings
Diff against target: 120 lines (+9/-13)
7 files modified
debian/rules (+0/-3)
plugins/system-update/update.cpp (+1/-1)
plugins/system-update/update_manager.cpp (+1/-0)
plugins/system-update/update_manager.h (+2/-1)
tests/CMakeLists.txt (+1/-0)
tests/autopilot/ubuntu_system_settings/tests/test_system_updates.py (+1/-1)
tests/plugins/system-update/tst_updatemanager.cpp (+3/-7)
To merge this branch: bzr merge lp:~laney/ubuntu-system-settings/fix-tests
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Diego Sarmentero (community) Approve
Sebastien Bacher (community) Approve
Review via email: mp+215417@code.launchpad.net

Commit message

Fix click package update checking and update available/not available signal emission.

Description of the change

Enable and fix the tests.

I'm not sure what I've done is correct, particularly r679. Please review.

Also I haven't checked it actually does fix the click updating bug yet, will do that shortly.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

looks good to me and fixes the click updates not being listed (bug #1306569)

review: Approve
682. By Iain Lane

IGNORE_UPDATES needs to be set to "IGNORE_UPDATES" to be effective

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

Thanks for the branch... Just a single question:
Why this change?:
31 m_systemCheckingUpdate = false;
32 - if (!m_apps.contains(packageName)) {
33 + if (!m_apps.contains(packageName) && update->updateRequired()) {
34 m_apps[packageName] = update;
35 m_model.insert(0, QVariant::fromValue(update));
36 Q_EMIT modelChanged();
37 }
38 - Q_EMIT updateAvailableFound(update->updateState());
39 + if (update->updateRequired())
40 + Q_EMIT updateAvailableFound(update->updateState());
41 + else
42 + Q_EMIT updatesNotFound();
43 +
44 reportCheckState();
45 }

As i can see, that function is only being called when this happen:
QObject::connect(&m_systemUpdate, SIGNAL(updateAvailable(const QString&, Update*)),
                  this, SLOT(registerSystemUpdate(const QString&, Update*)));

and system_update.cpp is already checking if the update is required and emitting the proper signal:
    if (update->updateRequired()) {
        Q_EMIT updateAvailable(packageName, update);
    } else {
        Q_EMIT updateNotFound();
    }

So, it only should go throw that function when the update is required.

review: Needs Information
Revision history for this message
Iain Lane (laney) wrote :

If you revert it you'll see that the tests start to fail. One of them tests that nothing is put into the model and there's also a test that these signals emitted, which wasn't happening.

It's the one I wasn't sure about though, so if you've a better fix then we can do that.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
683. By Iain Lane

merge lp:~diegosarmentero/ubuntu-system-settings/fix-update-not-required-test

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

+1
Thanks for the branch

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/rules'
2--- debian/rules 2014-03-10 12:34:30 +0000
3+++ debian/rules 2014-04-11 16:32:04 +0000
4@@ -21,6 +21,3 @@
5
6 %:
7 dh $@ --fail-missing --with python2,migrations
8-
9-override_dh_auto_test:
10- python tests/test_code.py
11
12=== modified file 'plugins/system-update/update.cpp'
13--- plugins/system-update/update.cpp 2014-03-19 19:04:50 +0000
14+++ plugins/system-update/update.cpp 2014-04-11 16:32:04 +0000
15@@ -61,7 +61,7 @@
16 void Update::setRemoteVersion(QString& version)
17 {
18 m_remote_version = version;
19- if (getIgnoreUpdates()) {
20+ if (!getIgnoreUpdates()) {
21 int result = debVS.CmpVersion(m_local_version.toUtf8().data(),
22 m_remote_version.toUtf8().data());
23
24
25=== modified file 'plugins/system-update/update_manager.cpp'
26--- plugins/system-update/update_manager.cpp 2014-03-27 13:13:43 +0000
27+++ plugins/system-update/update_manager.cpp 2014-04-11 16:32:04 +0000
28@@ -201,6 +201,7 @@
29 Q_EMIT modelChanged();
30 }
31 Q_EMIT updateAvailableFound(update->updateState());
32+
33 reportCheckState();
34 }
35
36
37=== modified file 'plugins/system-update/update_manager.h'
38--- plugins/system-update/update_manager.h 2014-03-17 02:08:47 +0000
39+++ plugins/system-update/update_manager.h 2014-04-11 16:32:04 +0000
40@@ -89,14 +89,15 @@
41 int get_downloadMode() { return m_downloadMode; }
42 void set_token(Token& t) { m_token = t; }
43 Token get_token() { return m_token; }
44+ void setCheckintUpdates(int value) { m_checkingUpdates = value; }
45 #endif
46
47 public Q_SLOTS:
48 void registerSystemUpdate(const QString& packageName, Update *update);
49+ void systemUpdateNotAvailable();
50
51 private Q_SLOTS:
52 void clickUpdateNotAvailable();
53- void systemUpdateNotAvailable();
54 void systemUpdatePaused(int value);
55 void processOutput();
56 void processUpdates();
57
58=== modified file 'tests/CMakeLists.txt'
59--- tests/CMakeLists.txt 2014-03-06 18:39:42 +0000
60+++ tests/CMakeLists.txt 2014-04-11 16:32:04 +0000
61@@ -39,5 +39,6 @@
62 INCLUDE_DIRECTORIES "${CMAKE_CURRENT_BINARY_DIR};${CMAKE_SOURCE_DIR}/wizard")
63 qt5_use_modules(tst-pagelist Core Test)
64 add_test(tst-pagelist tst-pagelist)
65+add_test(NAME python COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_code.py")
66
67 add_subdirectory(plugins)
68
69=== modified file 'tests/autopilot/ubuntu_system_settings/tests/test_system_updates.py'
70--- tests/autopilot/ubuntu_system_settings/tests/test_system_updates.py 2014-03-27 13:16:09 +0000
71+++ tests/autopilot/ubuntu_system_settings/tests/test_system_updates.py 2014-04-11 16:32:04 +0000
72@@ -26,7 +26,7 @@
73 def setUp(self):
74 # Set environment variables
75 os.environ["IGNORE_CREDENTIALS"] = "True"
76- os.environ["IGNORE_UPDATES"] = "True"
77+ os.environ["IGNORE_UPDATES"] = "IGNORE_UPDATES"
78 super(SystemUpdatesTestCases, self).setUp()
79
80 def test_show_updates(self):
81
82=== modified file 'tests/plugins/system-update/tst_updatemanager.cpp'
83--- tests/plugins/system-update/tst_updatemanager.cpp 2014-03-13 14:28:45 +0000
84+++ tests/plugins/system-update/tst_updatemanager.cpp 2014-04-11 16:32:04 +0000
85@@ -82,6 +82,7 @@
86 void UpdateManagerTest::testRegisterSystemUpdateNotRequired()
87 {
88 UpdateManager manager;
89+ manager.setCheckintUpdates(1);
90 QSignalSpy spy(&manager, SIGNAL(modelChanged()));
91 QSignalSpy spy2(&manager, SIGNAL(updateAvailableFound(bool)));
92 QSignalSpy spy3(&manager, SIGNAL(updatesNotFound()));
93@@ -90,17 +91,12 @@
94 QTRY_COMPARE(spy3.count(), 0);
95 QTRY_COMPARE(manager.get_apps().size(), 0);
96
97- Update *update = getUpdate();
98- update->setUpdateAvailable(false);
99-
100- manager.registerSystemUpdate(update->getPackageName(), update);
101+ manager.systemUpdateNotAvailable();
102 QTRY_COMPARE(spy.count(), 0);
103 QTRY_COMPARE(spy2.count(), 0);
104 QTRY_COMPARE(spy3.count(), 1);
105 QTRY_COMPARE(manager.get_apps().size(), 0);
106 QTRY_COMPARE(manager.get_model().size(), 0);
107-
108- update->deleteLater();
109 }
110
111 void UpdateManagerTest::testStartDownload()
112@@ -139,7 +135,7 @@
113 void UpdateManagerTest::testCheckUpdatesUpdateSignal()
114 {
115 UpdateManager manager;
116- QSignalSpy spy(&manager, SIGNAL(updateAvailableFound()));
117+ QSignalSpy spy(&manager, SIGNAL(updateAvailableFound(bool)));
118 QTRY_COMPARE(manager.get_apps().size(), 0);
119 manager.checkUpdates();
120 QTRY_COMPARE(manager.get_apps().size(), 4);

Subscribers

People subscribed via source and target branches