def setUpClass(cls): cls.base_url = 'http://localhost:%d' % PORT cls.crowd = crowd.CrowdServer(cls.base_url, APP_USER, APP_PASS) cls.server_thread = threading.Thread(target=crowdserverstub.run_server, args=(PORT, )) cls.server_thread.start() crowdserverstub.add_app(APP_USER, APP_PASS) crowdserverstub.add_user(USER, PASS) # There is a race to start the HTTP server before # the unit tests begin hitting it. Sleep briefly time.sleep(0.2)
def setUpClass(cls): cls.base_url = 'http://localhost:%d' % PORT cls.crowd = crowd.CrowdServer(cls.base_url, APP_USER, APP_PASS) cls.server_thread = threading.Thread( target=crowdserverstub.run_server, args=(PORT,)) cls.server_thread.start() crowdserverstub.add_app(APP_USER, APP_PASS) crowdserverstub.add_user(USER, PASS) # There is a race to start the HTTP server before # the unit tests begin hitting it. Sleep briefly time.sleep(0.2)
def testUserAttributesReturned(self): crowdserverstub.add_user('attruser', 'mypass', {'something': True}) result = self.crowd.get_user('attruser') self.assertIsNotNone(result) self.assertTrue('attributes' in result) self.assertTrue('something' in result['attributes'])