Merge lp:~canonical-platform-qa/snappy-ecosystem-tests/fix-snapcraft-logout into lp:snappy-ecosystem-tests

Proposed by Heber Parrucci
Status: Merged
Approved by: I Ahmad
Approved revision: 35
Merged at revision: 29
Proposed branch: lp:~canonical-platform-qa/snappy-ecosystem-tests/fix-snapcraft-logout
Merge into: lp:snappy-ecosystem-tests
Diff against target: 44 lines (+8/-12)
1 file modified
snappy_ecosystem_tests/helpers/snapcraft/client.py (+8/-12)
To merge this branch: bzr merge lp:~canonical-platform-qa/snappy-ecosystem-tests/fix-snapcraft-logout
Reviewer Review Type Date Requested Status
I Ahmad (community) Approve
platform-qa-bot continuous-integration Approve
Review via email: mp+318913@code.launchpad.net

Commit message

Fix snapcraft logout

Description of the change

Fix snapcraft logout

To post a comment you must log in.
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
I Ahmad (iahmad) wrote :

Looks good and working when tested locally

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'snappy_ecosystem_tests/helpers/snapcraft/client.py'
2--- snappy_ecosystem_tests/helpers/snapcraft/client.py 2017-03-02 14:13:12 +0000
3+++ snappy_ecosystem_tests/helpers/snapcraft/client.py 2017-03-03 14:11:14 +0000
4@@ -24,8 +24,6 @@
5 import subprocess
6 import time
7
8-import pexpect
9-
10 from snappy_ecosystem_tests.models.snap import Snap
11 from snappy_ecosystem_tests.utils import ssh
12 from snappy_ecosystem_tests.utils.commands import build_command
13@@ -56,6 +54,7 @@
14 """
15
16 COMMAND_LOGOUT = 'logout'
17+
18 COMMAND_REGISTER = 'register'
19 COMMAND_LIST_REGISTERED = 'list-registered'
20
21@@ -113,16 +112,13 @@
22 """Perform cleanup actions"""
23 self.logout()
24
25- def logout(self):
26- """logout of snapcraft store session"""
27- child = pexpect.spawn(build_snapcraft_command(COMMAND_LOGOUT))
28- err = child.expect('Credentials cleared.')
29- child.terminate(True)
30- child.wait()
31- if err is not 0:
32- raise ValueError("Failed to logout")
33-
34- self._login = False
35+ @staticmethod
36+ def logout():
37+ """logout of snapcraft store session
38+ :return: True if logout was successful, False otherwise
39+ """
40+ Snapcraft._run_snapcraft_command_ssh(COMMAND_LOGOUT)
41+ return not Snapcraft.is_logged_in()
42
43 @staticmethod
44 def login(email=LOGIN_EMAIL, password=LOGIN_PASSWORD):

Subscribers

People subscribed via source and target branches