def setUp(self): subject.config['credentials'] = { 'clientId': 'clientId', 'accessToken': 'accessToken', } keys = [ base.createTopicExchangeKey('primary_key', constant='primary'), base.createTopicExchangeKey('norm1'), base.createTopicExchangeKey('norm2'), base.createTopicExchangeKey('norm3'), base.createTopicExchangeKey('multi_key', multipleWords=True), ] topicEntry = base.createApiEntryTopicExchange('topicName', 'topicExchange', routingKey=keys) entries = [ base.createApiEntryFunction('no_args_no_input', 0, False), base.createApiEntryFunction('two_args_no_input', 2, False), base.createApiEntryFunction('no_args_with_input', 0, True), base.createApiEntryFunction('two_args_with_input', 2, True), base.createApiEntryFunction('NEVER_CALL_ME', 0, False), topicEntry ] self.apiRef = base.createApiRef(entries=entries) self.clientClass = subject.createApiClient('testApi', self.apiRef) self.client = self.clientClass({'rootUrl': self.test_root_url}) # Patch time.sleep so that we don't delay tests sleepPatcher = mock.patch('time.sleep') sleepSleep = sleepPatcher.start() sleepSleep.return_value = None self.addCleanup(sleepSleep.stop)
def setUp(self): subject.config['credentials'] = { 'clientId': 'clientId', 'accessToken': 'accessToken', } keys = [ base.createTopicExchangeKey('primary_key', constant='primary'), base.createTopicExchangeKey('norm1'), base.createTopicExchangeKey('norm2'), base.createTopicExchangeKey('norm3'), base.createTopicExchangeKey('multi_key', multipleWords=True), ] topicEntry = base.createApiEntryTopicExchange('topicName', 'topicExchange', routingKey=keys) entries = [ base.createApiEntryFunction('no_args_no_input', 0, False), base.createApiEntryFunction('two_args_no_input', 2, False), base.createApiEntryFunction('no_args_with_input', 0, True), base.createApiEntryFunction('two_args_with_input', 2, True), base.createApiEntryFunction('NEVER_CALL_ME', 0, False), topicEntry ] self.apiRef = base.createApiRef(entries=entries) self.clientClass = subject.createApiClient('testApi', self.apiRef) self.client = self.clientClass() # Patch time.sleep so that we don't delay tests sleepPatcher = mock.patch('time.sleep') sleepSleep = sleepPatcher.start() sleepSleep.return_value = None self.addCleanup(sleepSleep.stop)
def setUp(self): ClientTest.setUp(self) self.clientClass2 = subject.createApiClient('testApi', base.createApiRef()) self.client2 = self.clientClass2({'baseUrl': 'http://notlocalhost:5888/v2'})
def test_apiVersion_set_correctly_default(apiRef): apiRef = copy.deepcopy(apiRef) del apiRef['reference']['apiVersion'] clientClass = subject.createApiClient('testApi', apiRef) client = clientClass({'rootUrl': base.TEST_ROOT_URL}) assert client.apiVersion == 'v1'
def clientClass(apiRef): clientClass = subject.createApiClient('testApi', apiRef) yield clientClass
def test_apiVersion_set_correctly_default(self): apiRef = copy.deepcopy(self.apiRef) del apiRef['reference']['apiVersion'] clientClass = subject.createApiClient('testApi', apiRef) client = clientClass({'rootUrl': self.test_root_url}) self.assertEqual(client.apiVersion, 'v1')
def setUp(self): ClientTest.setUp(self) self.clientClass2 = subject.createApiClient('testApi', base.createApiRef()) self.client2 = self.clientClass2( {'baseUrl': 'http://notlocalhost:5888/v2'})
def test_apiVersion_set_correctly_default(self): apiRef = copy.deepcopy(self.apiRef) del apiRef['reference']['apiVersion'] clientClass = subject.createApiClient('testApi', apiRef) client = clientClass({'rootUrl': self.test_root_url}) self.assertEqual(client.apiVersion, 'v1')