Merge lp:~mvo/software-center/reinstall-previous-purchase-token-fix into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 3230
Proposed branch: lp:~mvo/software-center/reinstall-previous-purchase-token-fix
Merge into: lp:software-center
Diff against target: 57 lines (+22/-2)
2 files modified
softwarecenter/ui/gtk3/session/appmanager.py (+5/-1)
tests/gtk3/test_appmanager.py (+17/-1)
To merge this branch: bzr merge lp:~mvo/software-center/reinstall-previous-purchase-token-fix
Reviewer Review Type Date Requested Status
Dave Morley (community) reinstalled an app using this branch Approve
software-store-developers Pending
Review via email: mp+129166@code.launchpad.net

Description of the change

This branch fixes reinstall previous purchases that contain a system wide license key. LP: #1065481

To post a comment you must log in.
3231. By Michael Vogt

tests/gtk3/test_appmanager.py: ensure that the ApplicationManager has a valid oauth token

Revision history for this message
Dave Morley (davmor2) wrote :

I've tested this is functioning on a real app reinstall. Main doesn't work, however using this branch does. Indicating that this branch fixes the issue for reinstalling applications that have License Keys.

review: Approve (reinstalled an app using this branch)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'softwarecenter/ui/gtk3/session/appmanager.py'
--- softwarecenter/ui/gtk3/session/appmanager.py 2012-09-14 15:01:37 +0000
+++ softwarecenter/ui/gtk3/session/appmanager.py 2012-10-11 12:35:33 +0000
@@ -26,6 +26,7 @@
2626
27from gi.repository import GObject27from gi.repository import GObject
2828
29from softwarecenter.backend.ubuntusso import UbuntuSSO
29from softwarecenter.enums import AppActions30from softwarecenter.enums import AppActions
30from softwarecenter.db import DebFileApplication31from softwarecenter.db import DebFileApplication
31from softwarecenter.distro import get_current_arch, get_distro32from softwarecenter.distro import get_current_arch, get_distro
@@ -59,7 +60,10 @@
59 self.backend = backend60 self.backend = backend
60 self.distro = get_distro()61 self.distro = get_distro()
61 self.icons = icons62 self.icons = icons
62 self.oauth_token = ""63 # its ok to use the sync version here to get the token, this is
64 # very quick
65 helper = UbuntuSSO()
66 self.oauth_token = helper.find_oauth_token_sync()
6367
64 def _globalise_instance(self):68 def _globalise_instance(self):
65 global _appmanager69 global _appmanager
6670
=== modified file 'tests/gtk3/test_appmanager.py'
--- tests/gtk3/test_appmanager.py 2012-08-20 09:09:45 +0000
+++ tests/gtk3/test_appmanager.py 2012-10-11 12:35:33 +0000
@@ -1,6 +1,9 @@
1import unittest1import unittest
22
3from mock import Mock3from mock import (
4 Mock,
5 patch,
6 )
47
5from tests.utils import (8from tests.utils import (
6 do_events,9 do_events,
@@ -76,5 +79,18 @@
76 def _on_purchase_requested(self, *args):79 def _on_purchase_requested(self, *args):
77 self._purchase_requested_signal = True80 self._purchase_requested_signal = True
7881
82 def test_appmanager_requests_oauth_token(self):
83 oauth_token = { "moo": "bar",
84 "lala": "la",
85 }
86 # reset the global appmanager
87 softwarecenter.ui.gtk3.session.appmanager._appmanager = None
88 with patch("softwarecenter.ui.gtk3.session.appmanager.UbuntuSSO"
89 ".find_oauth_token_sync") as m:
90 m.return_value = oauth_token
91 app_manager = ApplicationManager(self.db, self.backend, self.icons)
92 self.assertEqual(app_manager.oauth_token, oauth_token)
93
94
79if __name__ == "__main__":95if __name__ == "__main__":
80 unittest.main()96 unittest.main()

Subscribers

People subscribed via source and target branches