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
1=== modified file 'src/test-click-webservice.vala'
2--- src/test-click-webservice.vala 2013-10-02 23:22:44 +0000
3+++ src/test-click-webservice.vala 2013-12-04 13:32:30 +0000
4@@ -92,70 +92,6 @@
5 }
6 }
7
8- public static void test_download_manager ()
9- {
10- HashTable<string, string> credentials = new HashTable<string, string> (str_hash, str_equal);
11- credentials["consumer_key"] = "...";
12- credentials["consumer_secret"] = "...";
13- credentials["token"] = "...";
14- credentials["token_secret"] = "...";
15-
16- var sd = new SignedDownload (credentials);
17- var url = "http://alecu.com.ar/test/click/demo.php";
18- var app_id = "org.example.fake.app";
19-
20- Download download = null;
21-
22-
23- MainLoop mainloop = new MainLoop ();
24- sd.start_download.begin(url, app_id, (obj, res) => {
25- try {
26- var download_object_path = sd.start_download.end (res);
27- debug ("download created for %s", url);
28- download = get_download (download_object_path);
29-
30- download.started.connect( (success) => {
31- debug ("Download started");
32- });
33- download.finished.connect( (error) => {
34- debug ("Download finished");
35- mainloop.quit ();
36- });
37- download.error.connect( (error) => {
38- debug ("Download errored");
39- mainloop.quit ();
40- });
41- download.progress.connect( (received, total) => {
42- debug ("Download progressing: %llu/%llu", received, total);
43- });
44- debug ("Download starting");
45- download.start ();
46- } catch (GLib.Error e) {
47- error ("Can't start download: %s", e.message);
48- }
49- });
50- assert (run_with_timeout (mainloop, 60000));
51-
52- debug ("actually starting download");
53- }
54-
55- public static void test_fetch_credentials ()
56- {
57- MainLoop mainloop = new MainLoop ();
58- var u1creds = new UbuntuoneCredentials ();
59-
60- u1creds.get_credentials.begin((obj, res) => {
61- mainloop.quit ();
62- try {
63- var creds = u1creds.get_credentials.end (res);
64- debug ("token: %s", creds["token"]);
65- } catch (GLib.Error e) {
66- error ("Can't fetch credentials: %s", e.message);
67- }
68- });
69- assert (run_with_timeout (mainloop, 10000));
70- }
71-
72 public static void test_click_interface ()
73 {
74 MainLoop mainloop = new MainLoop ();
75@@ -165,7 +101,6 @@
76 mainloop.quit ();
77 try {
78 var installed = click_if.get_installed.end (res);
79- debug ("first installed: %s", installed[0].title);
80 } catch (GLib.Error e) {
81 error ("Can't get list of installed click packages %s", e.message);
82 }
83@@ -213,23 +148,6 @@
84 assert_cmpstr (versions["com.ubuntu.developer.pedrocan.evilapp"], OperatorType.EQUAL, "0.4");
85 }
86
87- public static void test_click_get_dotdesktop ()
88- {
89- MainLoop mainloop = new MainLoop ();
90- var click_if = new ClickInterface ();
91-
92- click_if.get_dotdesktop.begin("com.ubuntu.ubuntu-weather", (obj, res) => {
93- mainloop.quit ();
94- try {
95- var dotdesktop = click_if.get_dotdesktop.end (res);
96- debug ("got dotdesktop: %s", dotdesktop);
97- } catch (GLib.Error e) {
98- error ("Can't get dotdesktop: %s", e.message);
99- }
100- });
101- assert (run_with_timeout (mainloop, 10000));
102- }
103-
104 public static void test_available_apps ()
105 {
106 MainLoop mainloop = new MainLoop ();
107@@ -247,38 +165,17 @@
108 assert (run_with_timeout (mainloop, 10000));
109 }
110
111- public static void test_app_details ()
112- {
113- MainLoop mainloop = new MainLoop ();
114- var click_ws = new ClickWebservice ();
115-
116- click_ws.get_details.begin("org.example.full_app", (obj, res) => {
117- mainloop.quit ();
118- try {
119- var app_details = click_ws.get_details.end (res);
120- debug ("download_url: %s", app_details.download_url);
121- } catch (GLib.Error e) {
122- error ("Can't get details for a click package: %s", e.message);
123- }
124- });
125- assert (run_with_timeout (mainloop, 10000));
126- }
127-
128 public static int main (string[] args)
129 {
130 Test.init (ref args);
131 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Architecture", test_click_architecture);
132 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Get_Versions", test_click_get_versions);
133 Test.add_data_func ("/Unit/ClickChecker/Test_Click_Interface", test_click_interface);
134- Test.add_data_func ("/Unit/ClickChecker/Test_Click_Get_DotDesktop", test_click_get_dotdesktop);
135 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result", test_parse_search_result);
136 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Search_Result_Item", test_parse_search_result_item);
137 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_App_Details", test_parse_app_details);
138 Test.add_data_func ("/Unit/ClickChecker/Test_Parse_Skinny_Details", test_parse_skinny_details);
139- Test.add_data_func ("/Unit/ClickChecker/Test_Download_Manager", test_download_manager);
140- Test.add_data_func ("/Unit/ClickChecker/Test_Fetch_Credentials", test_fetch_credentials);
141 Test.add_data_func ("/Unit/ClickChecker/Test_Available_Apps", test_available_apps);
142- Test.add_data_func ("/Unit/ClickChecker/Test_App_Details", test_app_details);
143 return Test.run ();
144 }
145 }

Subscribers

People subscribed via source and target branches

to all changes: