Merge lp:~dobey/unity-scope-click/working-tests into lp:unity-scope-click

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 83
Merged at revision: 82
Proposed branch: lp:~dobey/unity-scope-click/working-tests
Merge into: lp:unity-scope-click
Diff against target: 145 lines (+0/-103)
1 file modified
src/test-click-webservice.vala (+0/-103)
To merge this branch: bzr merge lp:~dobey/unity-scope-click/working-tests
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
PS Jenkins bot continuous-integration Approve
Mike McCracken (community) Approve
Roberto Alsina (community) Approve
Review via email: mp+197608@code.launchpad.net

Commit message

Get rid of tests that depend too heavily on external processes or data.

Description of the change

To test this:

sudo apt-get build-dep unity-scope-click
./autogen.sh
make
./src/click-scope-tests

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Roberto Alsina (ralsina) :
review: Approve
82. By dobey

Handle get_dotdesktop possibly returning null in the actual scope.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
83. By dobey

Revert the changes to get_dotdesktop and just delete that test for now too.

Revision history for this message
Mike McCracken (mikemc) wrote :

works for me

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alejandro J. Cura (alecu) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/test-click-webservice.vala'
--- src/test-click-webservice.vala 2013-10-02 23:22:44 +0000
+++ src/test-click-webservice.vala 2013-12-04 13:32:30 +0000
@@ -92,70 +92,6 @@
92 }92 }
93 }93 }
9494
95 public static void test_download_manager ()
96 {
97 HashTable<string, string> credentials = new HashTable<string, string> (str_hash, str_equal);
98 credentials["consumer_key"] = "...";
99 credentials["consumer_secret"] = "...";
100 credentials["token"] = "...";
101 credentials["token_secret"] = "...";
102
103 var sd = new SignedDownload (credentials);
104 var url = "http://alecu.com.ar/test/click/demo.php";
105 var app_id = "org.example.fake.app";
106
107 Download download = null;
108
109
110 MainLoop mainloop = new MainLoop ();
111 sd.start_download.begin(url, app_id, (obj, res) => {
112 try {
113 var download_object_path = sd.start_download.end (res);
114 debug ("download created for %s", url);
115 download = get_download (download_object_path);
116
117 download.started.connect( (success) => {
118 debug ("Download started");
119 });
120 download.finished.connect( (error) => {
121 debug ("Download finished");
122 mainloop.quit ();
123 });
124 download.error.connect( (error) => {
125 debug ("Download errored");
126 mainloop.quit ();
127 });
128 download.progress.connect( (received, total) => {
129 debug ("Download progressing: %llu/%llu", received, total);
130 });
131 debug ("Download starting");
132 download.start ();
133 } catch (GLib.Error e) {
134 error ("Can't start download: %s", e.message);
135 }
136 });
137 assert (run_with_timeout (mainloop, 60000));
138
139 debug ("actually starting download");
140 }
141
142 public static void test_fetch_credentials ()
143 {
144 MainLoop mainloop = new MainLoop ();
145 var u1creds = new UbuntuoneCredentials ();
146
147 u1creds.get_credentials.begin((obj, res) => {
148 mainloop.quit ();
149 try {
150 var creds = u1creds.get_credentials.end (res);
151 debug ("token: %s", creds["token"]);
152 } catch (GLib.Error e) {
153 error ("Can't fetch credentials: %s", e.message);
154 }
155 });
156 assert (run_with_timeout (mainloop, 10000));
157 }
158
159 public static void test_click_interface ()95 public static void test_click_interface ()
160 {96 {
161 MainLoop mainloop = new MainLoop ();97 MainLoop mainloop = new MainLoop ();
@@ -165,7 +101,6 @@
165 mainloop.quit ();101 mainloop.quit ();
166 try {102 try {
167 var installed = click_if.get_installed.end (res);103 var installed = click_if.get_installed.end (res);
168 debug ("first installed: %s", installed[0].title);
169 } catch (GLib.Error e) {104 } catch (GLib.Error e) {
170 error ("Can't get list of installed click packages %s", e.message);105 error ("Can't get list of installed click packages %s", e.message);
171 }106 }
@@ -213,23 +148,6 @@
213 assert_cmpstr (versions["com.ubuntu.developer.pedrocan.evilapp"], OperatorType.EQUAL, "0.4");148 assert_cmpstr (versions["com.ubuntu.developer.pedrocan.evilapp"], OperatorType.EQUAL, "0.4");
214 }149 }
215150
216 public static void test_click_get_dotdesktop ()
217 {
218 MainLoop mainloop = new MainLoop ();
219 var click_if = new ClickInterface ();
220
221 click_if.get_dotdesktop.begin("com.ubuntu.ubuntu-weather", (obj, res) => {
222 mainloop.quit ();
223 try {
224 var dotdesktop = click_if.get_dotdesktop.end (res);
225 debug ("got dotdesktop: %s", dotdesktop);
226 } catch (GLib.Error e) {
227 error ("Can't get dotdesktop: %s", e.message);
228 }
229 });
230 assert (run_with_timeout (mainloop, 10000));
231 }
232
233 public static void test_available_apps ()151 public static void test_available_apps ()
234 {152 {
235 MainLoop mainloop = new MainLoop ();153 MainLoop mainloop = new MainLoop ();
@@ -247,38 +165,17 @@
247 assert (run_with_timeout (mainloop, 10000));165 assert (run_with_timeout (mainloop, 10000));
248 }166 }
249167
250 public static void test_app_details ()
251 {
252 MainLoop mainloop = new MainLoop ();
253 var click_ws = new ClickWebservice ();
254
255 click_ws.get_details.begin("org.example.full_app", (obj, res) => {
256 mainloop.quit ();
257 try {
258 var app_details = click_ws.get_details.end (res);
259 debug ("download_url: %s", app_details.download_url);
260 } catch (GLib.Error e) {
261 error ("Can't get details for a click package: %s", e.message);
262 }
263 });
264 assert (run_with_timeout (mainloop, 10000));
265 }
266
267 public static int main (string[] args)168 public static int main (string[] args)
268 {169 {
269 Test.init (ref args);170 Test.init (ref args);
270 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Architecture", test_click_architecture);171 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Architecture", test_click_architecture);
271 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Get_Versions", test_click_get_versions);172 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Get_Versions", test_click_get_versions);
272 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Interface", test_click_interface);173 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Interface", test_click_interface);
273 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Get_DotDesktop", test_click_get_dotdesktop);
274 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result", test_parse_search_result);174 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result", test_parse_search_result);
275 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result_Item", test_parse_search_result_item);175 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result_Item", test_parse_search_result_item);
276 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_App_Details", test_parse_app_details);176 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_App_Details", test_parse_app_details);
277 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Skinny_Details", test_parse_skinny_details);177 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Skinny_Details", test_parse_skinny_details);
278 Test.add_data_func ("/Unit/ClickChecker/Test_Download_Manager", test_download_manager);
279 Test.add_data_func ("/Unit/ClickChecker/Test_Fetch_Credentials", test_fetch_credentials);
280 Test.add_data_func ("/Unit/ClickChecker/Test_Available_Apps", test_available_apps);178 Test.add_data_func ("/Unit/ClickChecker/Test_Available_Apps", test_available_apps);
281 Test.add_data_func ("/Unit/ClickChecker/Test_App_Details", test_app_details);
282 return Test.run ();179 return Test.run ();
283 }180 }
284}181}

Subscribers

People subscribed via source and target branches

to all changes: