def test_names(self): api = API(SPEC) api.getHeartbeat() for attr in ('getHeartbeat', 'addUserToCohort', 'returnCohortSettings'): self.assertTrue(hasattr(api, attr))
def test_read_spec_from_url(self): headers = {'Something': 'here'} with coserver(): api = API('http://localhost:8888/api.yaml', verbose=True) api.getDefault() api = API('http://localhost:8888/api.json', verbose=True) api.getDefault() res = api.getHeartbeat(request={'headers': headers}) echoed_headers = res.json()['headers'] self.assertEqual(echoed_headers['Something'], 'here')