コード例 #1
0
def apiRef(mocker):
    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
    ]
    apiRef = base.createApiRef(entries=entries)

    yield apiRef
コード例 #2
0
 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)
コード例 #3
0
 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)