Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/phabricator/tests/test_lister.py
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def request_index(self, request): | ||||
return int(idx) | return int(idx) | ||||
def get_fl(self, override_config=None): | def get_fl(self, override_config=None): | ||||
"""(Override) Retrieve an instance of fake lister (fl). | """(Override) Retrieve an instance of fake lister (fl). | ||||
""" | """ | ||||
if override_config or self.fl is None: | if override_config or self.fl is None: | ||||
credentials = {'phabricator': {'fake': [ | credentials = {'phabricator': {'fake': [ | ||||
{'password': 'toto'} | {'username': 'fake', 'password': 'toto'} | ||||
]}} | ]}} | ||||
override_config = dict(credentials=credentials, | override_config = dict(credentials=credentials, | ||||
**(override_config or {})) | **(override_config or {})) | ||||
self.fl = self.Lister(url='https://fakeurl', instance='fake', | self.fl = self.Lister(url='https://fakeurl', instance='fake', | ||||
override_config=override_config) | override_config=override_config) | ||||
self.fl.INITIAL_BACKOFF = 1 | self.fl.INITIAL_BACKOFF = 1 | ||||
self.fl.reset_backoff() | self.fl.reset_backoff() | ||||
Show All 30 Lines | def test_scheduled_tasks_multiple_instances(self, http_mocker): | ||||
# list first Phabricator instance | # list first Phabricator instance | ||||
fl.run() | fl.run() | ||||
fl.instance = 'other_fake' | fl.instance = 'other_fake' | ||||
fl.config['credentials'] = { | fl.config['credentials'] = { | ||||
'phabricator': { | 'phabricator': { | ||||
'other_fake': [{ | 'other_fake': [{ | ||||
'username': 'fake-user', | |||||
'password': 'foo' | 'password': 'foo' | ||||
}] | }] | ||||
} | } | ||||
} | } | ||||
# list second Phabricator instance hosting repositories having | # list second Phabricator instance hosting repositories having | ||||
# same ids as those listed from the first instance | # same ids as those listed from the first instance | ||||
self.good_api_response_file = \ | self.good_api_response_file = \ | ||||
Show All 36 Lines |