~ubuntu-branches/ubuntu/precise/ubuntuone-client/precise-201112142106

« back to all changes in this revision

Viewing changes to tests/platform/windows/test_credentials.py

  • Committer: Bazaar Package Importer
  • Author(s): Rodney Dawes
  • Date: 2011-08-25 16:11:47 UTC
  • mfrom: (1.1.54 upstream)
  • Revision ID: james.westby@ubuntu.com-20110825161147-v6zedpznh2evnurj
Tags: 1.7.2-0ubuntu1
* New upstream release.
  - Work correctly with static and GI bindings of gobject (LP: #829186)

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from twisted.internet import defer
21
21
from twisted.trial.unittest import TestCase
22
22
 
23
 
from ubuntuone.platform.windows import credentials
 
23
from ubuntuone.platform.credentials.windows import (
 
24
    CredentialsManagement,
 
25
    RemovableSignal,
 
26
)
24
27
 
25
28
TEST_APP_NAME = "test application"
26
29
TEST_ERROR_DICT = {}
93
96
        """__call__ works as expected."""
94
97
        sample_store = []
95
98
        test_cb = lambda app_name, creds: sample_store.append(creds)
96
 
        rs = credentials.RemovableSignal(self.proxy, "on_credentials_found_cb",
97
 
                                         test_cb)
 
99
        rs = RemovableSignal(self.proxy, "on_credentials_found_cb", test_cb)
98
100
        rs(TEST_APP_NAME, TEST_CREDENTIALS)
99
101
        self.assertEqual(sample_store[0], TEST_CREDENTIALS)
100
102
 
102
104
        """The signal has a .remove that removes the callback."""
103
105
        sample_store = []
104
106
        test_cb = lambda app_name, creds: sample_store.append(creds)
105
 
        rs = credentials.RemovableSignal(self.proxy, "on_credentials_found_cb",
106
 
                                         test_cb)
 
107
        rs = RemovableSignal(self.proxy, "on_credentials_found_cb", test_cb)
107
108
        rs.remove()
108
109
        rs(TEST_APP_NAME, TEST_CREDENTIALS)
109
110
        self.assertEqual(len(sample_store), 0)
117
118
    def setUp(self):
118
119
        """Initialize these tests."""
119
120
        self.proxy = FakeSSOProxy()
120
 
        self.cm = credentials.CredentialsManagement(self.proxy)
 
121
        self.cm = CredentialsManagement(self.proxy)
121
122
 
122
123
    def test_find_credentials(self):
123
124
        """Test the find_credentials method."""
177
178
        d = defer.Deferred()
178
179
 
179
180
        def signal_handler(*args):
180
 
            """Fake the behaviour of CredentialsManagementToolRoot."""
 
181
            """Fake the behaviour of CredentialsManagementTool."""
181
182
            d.callback(args[0] if len(args) > 0 else None)
182
183
 
183
184
        register = getattr(self.cm, "register_to_" + signal_name)