74
74
super(TestUpdateDesignDocuments, self).setUp()
75
75
xdg_data = os.path.split(test_environment.test_context.db_dir)[0]
77
shutil.rmtree(os.path.join(xdg_data, "desktop-couch"))
77
os.mkdir(os.path.join(xdg_data, "desktop-couch"))
79
pass # don't worry if folder does not exist
80
os.mkdir(os.path.join(xdg_data, "desktop-couch"))
79
pass # don't worry if the folder already exists
82
81
os.mkdir(os.path.join(xdg_data, "desktop-couch", d))
83
82
for f, data in FILES.items():
140
def test_pair_ubuntuone_with_sso(self):
141
""" Test the pairing with ubuntu one.
143
Ensure that the pair ubuntu one method is called when we do have
146
from desktopcouch.start_local_couchdb import update_pairing_service
148
sso_mock = mocker.mock()
149
pair_ubuntu_one_mock = mocker.replace(
150
'desktopcouch.pair.couchdb_pairing.' +
151
'ubuntuone_pairing.pair_with_ubuntuone')
152
# make the sso credentials return a dictionary with fake data
153
sso_mock.find_credentials('Ubuntu One')
154
mocker.result({'fake':'credential'})
155
pair_ubuntu_one_mock()
157
# call the start method to ensure that the methods are correctly called
158
update_pairing_service(sso_mock)
161
def test_pair_ubuntuone_without_sso(self):
162
""" Test the pairing with ubuntu one.
164
Ensure that the pair ubuntu one method is called when we do have
167
from desktopcouch.start_local_couchdb import update_pairing_service
169
pair_ubuntu_one_mock = mocker.replace(
170
'desktopcouch.pair.couchdb_pairing.' +
171
'ubuntuone_pairing.pair_with_ubuntuone')
172
# make the sso credentials return a dictionary with fake data
173
mocker.result({'fake':'credential'})
174
# pair with ubuntu one never called!
176
# call the start method to ensure that the methods are correctly called
177
update_pairing_service(sso=None, test_import_fails=True)