Merge lp:~diegosarmentero/pay-ui/pay-errors into lp:pay-ui

Proposed by Diego Sarmentero
Status: Merged
Approved by: dobey
Approved revision: 7
Merged at revision: 5
Proposed branch: lp:~diegosarmentero/pay-ui/pay-errors
Merge into: lp:pay-ui
Diff against target: 495 lines (+158/-23)
11 files modified
app/payui.qml (+76/-14)
app/ui/CheckoutPage.qml (+22/-1)
app/ui/DirectPurchase.qml (+19/-0)
app/ui/UbuntuPurchaseWebkit.qml (+1/-5)
backend/modules/payui/network.cpp (+6/-0)
backend/modules/payui/network.h (+1/-0)
backend/modules/payui/purchase.cpp (+11/-1)
backend/modules/payui/purchase.h (+2/-0)
backend/tests/mock_click_server.py (+8/-0)
backend/tests/test_network.cpp (+11/-1)
manifest.json (+1/-1)
To merge this branch: bzr merge lp:~diegosarmentero/pay-ui/pay-errors
Reviewer Review Type Date Requested Status
Alejandro J. Cura (community) Approve
dobey (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+225397@code.launchpad.net

Commit message

- Showing errors and give the user the chance to recover from them.
- Improve logging

Description of the change

Not quit on any error, but instead show a message to the user, and let the user decide the action to follow.

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
Alejandro J. Cura (alecu) wrote :

Please commit this branch with --fixes lp:1333394

Why are there no unit tests for the qml bits?

review: Needs Fixing
7. By Diego Sarmentero

linking bug

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

> Please commit this branch with --fixes lp:1333394

Done

>
> Why are there no unit tests for the qml bits?

As I mentioned yesterday, we can't do qml tests YET, because we need to load the Purchase plugin, and there is a bug with autopilot which I already mentioned to elopio and he confirmed it that for some reason is breaking autopilot on loading those qml plugins.

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 :

On Thu, Jul 3, 2014 at 8:29 AM, Diego Sarmentero
<email address hidden> wrote:
>> Please commit this branch with --fixes lp:1333394
>
> Done
>
>>
>> Why are there no unit tests for the qml bits?
>
> As I mentioned yesterday, we can't do qml tests YET, because we need to load the Purchase plugin, and there is a bug with autopilot which I already mentioned to elopio and he confirmed it that for some reason is breaking autopilot on loading those qml plugins.

Please link here the autopilot bug, and please open a new bug for the
missing tests in pay-ui.

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

> Please commit this branch with --fixes lp:1333394
>
> Why are there no unit tests for the qml bits?

Bug created for this: https://bugs.launchpad.net/pay-ui/+bug/1337311

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

Code looks good, and tested on mako, seems to be working ok.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/payui.qml'
--- app/payui.qml 2014-06-25 20:58:29 +0000
+++ app/payui.qml 2014-07-03 11:28:29 +0000
@@ -6,9 +6,12 @@
6import "ui"6import "ui"
77
8/*!8/*!
9 \brief MainView with Tabs element.9 states:
10 First Tab has a single Label and10 - add-payment
11 second Tab has a single ToolbarAction.11 - direct
12 - buy-interaction
13 - checkout
14 - no-credentials
12*/15*/
1316
14MainView {17MainView {
@@ -32,6 +35,8 @@
3235
33 property bool loading: true36 property bool loading: true
34 property bool purchasing: false37 property bool purchasing: false
38 property string errorTitle: ""
39 property string errorMessage: ""
3540
3641
37 AccountServiceModel {42 AccountServiceModel {
@@ -55,8 +60,10 @@
55 if (payments.length == 0) {60 if (payments.length == 0) {
56 webkit.title = i18n.tr("Add Payment");61 webkit.title = i18n.tr("Add Payment");
57 webkit.url = purchase.getAddPaymentUrl();62 webkit.url = purchase.getAddPaymentUrl();
63 mainView.state = "add-payment";
58 pageStack.push(webkit);64 pageStack.push(webkit);
59 } else {65 } else {
66 mainView.state = "direct";
60 pageStack.push(direct);67 pageStack.push(direct);
61 }68 }
62 hideLoading();69 hideLoading();
@@ -65,26 +72,37 @@
65 onBuyItemFailed: {72 onBuyItemFailed: {
66 mainView.purchasing = false;73 mainView.purchasing = false;
67 hideLoading();74 hideLoading();
68 purchase.quitCancel();75 var title = i18n.tr("Purchase failed");
76 var message = i18n.tr("The purchase couldn't be completed.");
77 mainView.showErrorDialog(title, message);
69 }78 }
7079
71 onBuyItemSucceeded: {80 onBuyItemSucceeded: {
72 Qt.quit();81 purchase.quitSuccess();
73 }82 }
7483
75 onBuyInterationRequired: {84 onBuyInterationRequired: {
76 mainView.purchasing = false;85 mainView.purchasing = false;
77 webkit.title = "";86 webkit.title = "";
78 webkit.url = url;87 webkit.url = url;
88 mainView.state = "buy-interaction";
79 pageStack.push(webkit);89 pageStack.push(webkit);
80 }90 }
8191
82 onError: {92 onError: {
83 purchase.quitCancel();93 hideLoading();
84 hideLoading();94 var title = i18n.tr("Error contacting the server");
95 var message = i18n.tr("Do you want to try again?");
96 mainView.showErrorDialog(title, message);
97 }
98
99 onAuthenticationError: {
100 hideLoading();
101 pageStack.currentPage.showWrongPassword();
85 }102 }
86103
87 onCredentialsNotFound: {104 onCredentialsNotFound: {
105 mainView.state = "no-credentials";
88 pageStack.push(noCredentials);106 pageStack.push(noCredentials);
89 hideLoading();107 hideLoading();
90 }108 }
@@ -99,6 +117,12 @@
99 mainView.loading = false;117 mainView.loading = false;
100 }118 }
101119
120 function showErrorDialog(title, message) {
121 mainView.errorTitle = title;
122 mainView.errorMessage = message;
123 PopupUtils.open(errorDialogContainer);
124 }
125
102 Component {126 Component {
103 id: loadingDialogContainer127 id: loadingDialogContainer
104 Dialog {128 Dialog {
@@ -127,6 +151,33 @@
127 }151 }
128 }152 }
129153
154 Component {
155 id: errorDialogContainer
156 Dialog {
157 id: errorDialog
158 title: mainView.errorTitle
159 text: mainView.errorMessage
160
161 Button {
162 text: i18n.tr("Retry")
163 color: UbuntuColors.orange
164 onClicked: {
165 showLoading();
166 purchase.checkCredentials();
167 PopupUtils.close(errorDialog);
168 }
169 }
170 Button {
171 text: i18n.tr("Exit")
172 color: UbuntuColors.coolGrey
173 onClicked: {
174 PopupUtils.close(errorDialog);
175 purchase.quitCancel();
176 }
177 }
178 }
179 }
180
130 PageStack {181 PageStack {
131 id: pageStack182 id: pageStack
132 Component.onCompleted: {183 Component.onCompleted: {
@@ -140,6 +191,7 @@
140 account: accounts191 account: accounts
141192
142 onShowPaymentTypes: {193 onShowPaymentTypes: {
194 mainView.state = "checkout";
143 pageStack.push(checkout);195 pageStack.push(checkout);
144 }196 }
145197
@@ -172,6 +224,7 @@
172 onAddCreditCard: {224 onAddCreditCard: {
173 webkit.title = i18n.tr("Add Payment");225 webkit.title = i18n.tr("Add Payment");
174 webkit.url = purchase.getAddPaymentUrl();226 webkit.url = purchase.getAddPaymentUrl();
227 mainView.state = "add-payment";
175 pageStack.push(webkit);228 pageStack.push(webkit);
176 }229 }
177 }230 }
@@ -180,16 +233,25 @@
180 id: webkit233 id: webkit
181 visible: false234 visible: false
182235
183 onPayTypeAdded: {
184 showLoading();
185 purchase.getPaymentTypes();
186 pageStack.push(checkout);
187 }
188 onPurchaseCanceled: {236 onPurchaseCanceled: {
189 purchase.quitCancel();237 hideLoading();
238 if (mainView.state == "add-payment") {
239 var title = i18n.tr("Adding Credit Card failed");
240 var message = i18n.tr("Do you want to try again?");
241 mainView.showErrorDialog(title, message);
242 } else {
243 var title = i18n.tr("Purchase failed");
244 var message = i18n.tr("The purchase couldn't be completed.");
245 mainView.showErrorDialog(title, message);
246 }
190 }247 }
191 onPurchaseSucceeded: {248 onPurchaseSucceeded: {
192 pageStack.push(success);249 if (mainView.state == "add-payment") {
250 showLoading();
251 purchase.getPaymentTypes();
252 } else {
253 purchase.quitSuccess();
254 }
193 }255 }
194256
195 onLoading: {257 onLoading: {
196258
=== modified file 'app/ui/CheckoutPage.qml'
--- app/ui/CheckoutPage.qml 2014-06-25 20:58:29 +0000
+++ app/ui/CheckoutPage.qml 2014-07-03 11:28:29 +0000
@@ -24,6 +24,7 @@
2424
25 title: selector.currentlyExpanded ? i18n.tr("Payment type") : i18n.tr("Checkout")25 title: selector.currentlyExpanded ? i18n.tr("Payment type") : i18n.tr("Checkout")
2626
27 property bool _errorVisible: false
27 property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 028 property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
28 property alias itemTitle: titleLabel.text29 property alias itemTitle: titleLabel.text
29 property alias itemSubtitle: subtitleLabel.text30 property alias itemSubtitle: subtitleLabel.text
@@ -37,11 +38,16 @@
37 signal addCreditCard38 signal addCreditCard
3839
39 function launchPurchase() {40 function launchPurchase() {
41 pageCheckout._errorVisible = false;
40 var pay = selector.model[selector.selectedIndex];42 var pay = selector.model[selector.selectedIndex];
41 var email = accountView.currentItem.email;43 var email = accountView.currentItem.email;
42 pageCheckout.buy(email, passwordField.text, pay.paymentId, pay.backendId);44 pageCheckout.buy(email, passwordField.text, pay.paymentId, pay.backendId);
43 }45 }
4446
47 function showWrongPassword() {
48 pageCheckout._errorVisible = true;
49 }
50
45 Flickable {51 Flickable {
46 id: checkoutFlickable52 id: checkoutFlickable
47 anchors {53 anchors {
@@ -261,13 +267,28 @@
261 Keys.onReturnPressed: launchPurchase();267 Keys.onReturnPressed: launchPurchase();
262 }268 }
263269
270 Label {
271 id: errorPasswordLabel
272 objectName: "errorPasswordLabel"
273 color: "red"
274 text: i18n.tr("Incorrect Password, please try again.")
275 wrapMode: Text.WordWrap
276 visible: selector.currentlyExpanded ? false : pageCheckout._errorVisible
277 anchors {
278 left: parent.left
279 right: parent.right
280 top: passwordField.bottom
281 margins: units.gu(1)
282 }
283 }
284
264 Rectangle {285 Rectangle {
265 id: separator286 id: separator
266 color: "#dedede"287 color: "#dedede"
267 anchors {288 anchors {
268 left: parent.left289 left: parent.left
269 right: parent.right290 right: parent.right
270 top: selector.currentlyExpanded ? manageCardLabel.bottom : passwordField.bottom291 top: selector.currentlyExpanded ? manageCardLabel.bottom : errorPasswordLabel.bottom
271 topMargin: units.gu(2)292 topMargin: units.gu(2)
272 }293 }
273 height: 2294 height: 2
274295
=== modified file 'app/ui/DirectPurchase.qml'
--- app/ui/DirectPurchase.qml 2014-06-25 20:58:29 +0000
+++ app/ui/DirectPurchase.qml 2014-07-03 11:28:29 +0000
@@ -27,10 +27,15 @@
27 property alias account: accountView.model27 property alias account: accountView.model
2828
29 function launchPurchase() {29 function launchPurchase() {
30 errorPasswordLabel.visible = false;
30 var email = accountView.currentItem.text;31 var email = accountView.currentItem.text;
31 pageDirectPayment.buy(email, passwordField.text);32 pageDirectPayment.buy(email, passwordField.text);
32 }33 }
3334
35 function showWrongPassword() {
36 errorPasswordLabel.visible = true;
37 }
38
34 Column {39 Column {
35 spacing: units.gu(2)40 spacing: units.gu(2)
36 anchors.fill: parent41 anchors.fill: parent
@@ -96,6 +101,19 @@
96 }101 }
97102
98 Label {103 Label {
104 id: errorPasswordLabel
105 objectName: "errorPasswordLabel"
106 color: "red"
107 text: i18n.tr("Incorrect Password, please try again.")
108 wrapMode: Text.WordWrap
109 visible: false
110 anchors {
111 left: parent.left
112 right: parent.right
113 }
114 }
115
116 Label {
99 id: paymentTypeLabel117 id: paymentTypeLabel
100 objectName: "paymentTypeLabel"118 objectName: "paymentTypeLabel"
101 textFormat: Text.RichText119 textFormat: Text.RichText
@@ -106,6 +124,7 @@
106 right: parent.right124 right: parent.right
107 }125 }
108 onLinkActivated: {126 onLinkActivated: {
127 errorPasswordLabel.visible = false;
109 pageDirectPayment.showPaymentTypes();128 pageDirectPayment.showPaymentTypes();
110 }129 }
111 }130 }
112131
=== modified file 'app/ui/UbuntuPurchaseWebkit.qml'
--- app/ui/UbuntuPurchaseWebkit.qml 2014-06-23 18:20:45 +0000
+++ app/ui/UbuntuPurchaseWebkit.qml 2014-07-03 11:28:29 +0000
@@ -17,7 +17,7 @@
17import QtQuick 2.017import QtQuick 2.0
18import Ubuntu.Components 0.118import Ubuntu.Components 0.1
19import Ubuntu.Components.Popups 0.119import Ubuntu.Components.Popups 0.1
20import QtWebKit 3.020import com.canonical.Oxide 1.0
2121
2222
23Page {23Page {
@@ -26,7 +26,6 @@
2626
27 signal purchaseSucceeded()27 signal purchaseSucceeded()
28 signal purchaseCanceled()28 signal purchaseCanceled()
29 signal payTypeAdded()
30 signal loading(bool value)29 signal loading(bool value)
3130
32 property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 031 property int keyboardSize: Qt.inputMethod.visible ? Qt.inputMethod.keyboardRectangle.height : 0
@@ -75,9 +74,6 @@
75 pageWebkit.closePurchase();74 pageWebkit.closePurchase();
76 pageWebkit.purchaseCanceled();75 pageWebkit.purchaseCanceled();
77 return;76 return;
78 } else if(/^(purchase):\/\/payAdded/.test(request.url)) {
79 pageWebkit.payTypeAdded();
80 return;
81 }77 }
8278
83 request.action = WebView.AcceptRequest;79 request.action = WebView.AcceptRequest;
8480
=== modified file 'backend/modules/payui/network.cpp'
--- backend/modules/payui/network.cpp 2014-06-25 20:58:29 +0000
+++ backend/modules/payui/network.cpp 2014-07-03 11:28:29 +0000
@@ -34,6 +34,7 @@
34#define PAY_BASE_URL "https://sc.ubuntu.com/api/2.0/click/"34#define PAY_BASE_URL "https://sc.ubuntu.com/api/2.0/click/"
35#define ACCOUNT_CREDS_URL "https://login.ubuntu.com/api/v2/tokens/oauth"35#define ACCOUNT_CREDS_URL "https://login.ubuntu.com/api/v2/tokens/oauth"
36#define ADD_PAYMENT_URL "https://sc.ubuntu.com/api/2.0/click/paymentmethods/add/"36#define ADD_PAYMENT_URL "https://sc.ubuntu.com/api/2.0/click/paymentmethods/add/"
37//<matiasb> gatox: this is the url, in staging: https://sc.staging.ubuntu.com/click/payment-method/add/
3738
38#define PREFERED_PAYMENT_TYPE "0"39#define PREFERED_PAYMENT_TYPE "0"
39#define PAYMENT_TYPES "1"40#define PAYMENT_TYPES "1"
@@ -159,11 +160,14 @@
159 QString state = object.value("state").toString();160 QString state = object.value("state").toString();
160161
161 if (state == BUY_COMPLETE) {162 if (state == BUY_COMPLETE) {
163 qDebug() << "BUY STATE: complete";
162 Q_EMIT buyItemSucceeded();164 Q_EMIT buyItemSucceeded();
163 } else if (state == BUY_IN_PROGRESS) {165 } else if (state == BUY_IN_PROGRESS) {
166 qDebug() << "BUY STATE: in progress";
164 QString redirect_to = object.value("redirect_to").toString();167 QString redirect_to = object.value("redirect_to").toString();
165 Q_EMIT buyInteractionRequired(redirect_to);168 Q_EMIT buyInteractionRequired(redirect_to);
166 } else {169 } else {
170 qDebug() << "BUY STATE: failed";
167 Q_EMIT buyItemFailed();171 Q_EMIT buyItemFailed();
168 }172 }
169 } else if (state->operation.contains(ITEM_INFO) && document.isObject()) {173 } else if (state->operation.contains(ITEM_INFO) && document.isObject()) {
@@ -190,6 +194,8 @@
190 Q_EMIT error(message);194 Q_EMIT error(message);
191 }195 }
192196
197 } else if (httpStatus == 401 || httpStatus == 403) {
198 Q_EMIT authenticationError();
193 } else {199 } else {
194 Q_EMIT error(QString::number(httpStatus));200 Q_EMIT error(QString::number(httpStatus));
195 }201 }
196202
=== modified file 'backend/modules/payui/network.h'
--- backend/modules/payui/network.h 2014-06-25 20:58:29 +0000
+++ backend/modules/payui/network.h 2014-07-03 11:28:29 +0000
@@ -70,6 +70,7 @@
70 void buyItemFailed();70 void buyItemFailed();
71 void buyInteractionRequired(QString url);71 void buyInteractionRequired(QString url);
72 void error(QString message);72 void error(QString message);
73 void authenticationError();
73 void credentialsNotFound();74 void credentialsNotFound();
74 void credentialsFound();75 void credentialsFound();
75 void credentialsUpdated();76 void credentialsUpdated();
7677
=== modified file 'backend/modules/payui/purchase.cpp'
--- backend/modules/payui/purchase.cpp 2014-06-23 18:20:45 +0000
+++ backend/modules/payui/purchase.cpp 2014-07-03 11:28:29 +0000
@@ -26,6 +26,8 @@
26 this, &Purchase::buyInterationRequired);26 this, &Purchase::buyInterationRequired);
27 QObject::connect(&m_network, &Network::error,27 QObject::connect(&m_network, &Network::error,
28 this, &Purchase::error);28 this, &Purchase::error);
29 QObject::connect(&m_network, &Network::authenticationError,
30 this, &Purchase::authenticationError);
29 QObject::connect(&m_network, &Network::credentialsNotFound,31 QObject::connect(&m_network, &Network::credentialsNotFound,
30 this, &Purchase::credentialsNotFound);32 this, &Purchase::credentialsNotFound);
31 QObject::connect(&m_network, &Network::credentialsFound,33 QObject::connect(&m_network, &Network::credentialsFound,
@@ -55,13 +57,21 @@
5557
56void Purchase::quitCancel()58void Purchase::quitCancel()
57{59{
60 qDebug() << "Purchase Canceled: exit code 1";
58 QCoreApplication::exit(1);61 QCoreApplication::exit(1);
59}62}
6063
64void Purchase::quitSuccess()
65{
66 qDebug() << "Purchase Succeeded: exit code 0";
67 QCoreApplication::exit(0);
68}
69
61void Purchase::checkCredentials()70void Purchase::checkCredentials()
62{71{
63 if (m_appid.isEmpty() && m_itemid.isEmpty()) {72 if (m_appid.isEmpty() && m_itemid.isEmpty()) {
64 QCoreApplication::exit(1);73 qDebug() << "AppId or ItemId not provided";
74 quitCancel();
65 } else {75 } else {
66 qDebug() << "Getting Item Details";76 qDebug() << "Getting Item Details";
67 getItemDetails(m_appid, m_itemid);77 getItemDetails(m_appid, m_itemid);
6878
=== modified file 'backend/modules/payui/purchase.h'
--- backend/modules/payui/purchase.h 2014-06-23 18:20:45 +0000
+++ backend/modules/payui/purchase.h 2014-07-03 11:28:29 +0000
@@ -21,6 +21,7 @@
21 Q_INVOKABLE void checkCredentials();21 Q_INVOKABLE void checkCredentials();
22 Q_INVOKABLE QString getAddPaymentUrl();22 Q_INVOKABLE QString getAddPaymentUrl();
2323
24 Q_INVOKABLE void quitSuccess();
24 Q_INVOKABLE void quitCancel();25 Q_INVOKABLE void quitCancel();
2526
26Q_SIGNALS:27Q_SIGNALS:
@@ -30,6 +31,7 @@
30 void buyItemFailed();31 void buyItemFailed();
31 void buyInterationRequired(QString url);32 void buyInterationRequired(QString url);
32 void error(QString message);33 void error(QString message);
34 void authenticationError();
33 void credentialsNotFound();35 void credentialsNotFound();
34 void credentialsFound();36 void credentialsFound();
3537
3638
=== modified file 'backend/tests/mock_click_server.py'
--- backend/tests/mock_click_server.py 2014-06-23 18:20:45 +0000
+++ backend/tests/mock_click_server.py 2014-07-03 11:28:29 +0000
@@ -114,6 +114,12 @@
114 self.end_headers()114 self.end_headers()
115 self.wfile.write(bytes(json.dumps(response), 'UTF-8'))115 self.wfile.write(bytes(json.dumps(response), 'UTF-8'))
116116
117 def response_auth_error(self):
118 self.send_response(401)
119 self.send_header("Content-type", "application/json")
120 self.end_headers()
121 self.wfile.write(bytes(json.dumps(dict()), 'UTF-8'))
122
117 def do_POST(self):123 def do_POST(self):
118 """Respond to a POST request."""124 """Respond to a POST request."""
119 #content = self.rfile.read(int(self.headers.get('content-length')))125 #content = self.rfile.read(int(self.headers.get('content-length')))
@@ -135,6 +141,8 @@
135 elif self.path.find("iteminfo/") != -1:141 elif self.path.find("iteminfo/") != -1:
136 fail = self.path.find("/fail/") != -1142 fail = self.path.find("/fail/") != -1
137 self.response_item_info(fail)143 self.response_item_info(fail)
144 elif self.path.find("/authError/") != -1:
145 self.response_auth_error()
138 elif self.path.find("shutdown") != -1:146 elif self.path.find("shutdown") != -1:
139 global KEEP_ALIVE147 global KEEP_ALIVE
140 KEEP_ALIVE = False148 KEEP_ALIVE = False
141149
=== modified file 'backend/tests/test_network.cpp'
--- backend/tests/test_network.cpp 2014-06-25 20:58:29 +0000
+++ backend/tests/test_network.cpp 2014-07-03 11:28:29 +0000
@@ -40,6 +40,7 @@
4040
41private slots:41private slots:
42 void initTestCase();42 void initTestCase();
43 void testNetworkAuthenticationError();
43 void testNetworkGetPaymentTypes();44 void testNetworkGetPaymentTypes();
44 void testNetworkGetPaymentTypesFail();45 void testNetworkGetPaymentTypesFail();
45 void testNetworkBuyItem();46 void testNetworkBuyItem();
@@ -62,7 +63,7 @@
62void TestNetwork::initTestCase()63void TestNetwork::initTestCase()
63{64{
64 qDebug() << "Starting Server";65 qDebug() << "Starting Server";
65// network.setCredentials(Token("token_key", "token_secret", "consumer_key", "consumer_secret"));66 network.setCredentials(Token("token_key", "token_secret", "consumer_key", "consumer_secret"));
66 process = new QProcess(this);67 process = new QProcess(this);
67 QSignalSpy spy(process, SIGNAL(started()));68 QSignalSpy spy(process, SIGNAL(started()));
68 process->setWorkingDirectory(QDir::currentPath() + "/backend/tests/");69 process->setWorkingDirectory(QDir::currentPath() + "/backend/tests/");
@@ -80,6 +81,15 @@
80 QTRY_COMPARE(spy2.count(), 1);81 QTRY_COMPARE(spy2.count(), 1);
81}82}
8283
84void TestNetwork::testNetworkAuthenticationError()
85{
86 setenv("ACCOUNT_CREDS_URL", "http://localhost:8000/authError/", 1);
87 setenv("PAY_BASE_URL", "http://localhost:8000/", 1);
88 QSignalSpy spy(&network, SIGNAL(authenticationError()));
89 network.buyItem("email", "password", "appid", "itemid", "paymentid", "backendid");
90 QTRY_COMPARE(spy.count(), 1);
91}
92
83void TestNetwork::testNetworkGetPaymentTypes()93void TestNetwork::testNetworkGetPaymentTypes()
84{94{
85 setenv("PAY_BASE_URL", "http://localhost:8000/", 1); 95 setenv("PAY_BASE_URL", "http://localhost:8000/", 1);
8696
=== modified file 'manifest.json'
--- manifest.json 2014-06-25 20:58:29 +0000
+++ manifest.json 2014-07-03 11:28:29 +0000
@@ -10,6 +10,6 @@
10 "desktop": "payui.desktop"10 "desktop": "payui.desktop"
11 }11 }
12 },12 },
13 "version": "0.2",13 "version": "0.2.5",
14 "maintainer": "Sarmentero Diego <diego.sarmentero@canonical.com>"14 "maintainer": "Sarmentero Diego <diego.sarmentero@canonical.com>"
15}15}
16\ No newline at end of file16\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: