def route_login(): # params params = params_from_request(request) if params is None: response = json.dumps({'error': "unsupported content-type -> " + str(request.content_type)}) return response, 400 else: return api.login(params=params)
def test_login(self, uid="*****@*****.**", usecret="1234", result=False): self.test_add_user(uid=uid, usecret=usecret, result=result) params_invalid_0 = None params_invalid_1 = dict() params_invalid_1['uid'] = uid params_valid = dict(params_invalid_1) params_valid['secret'] = usecret invalid_response_0, inv_resp_code_0 = api.login(params=params_invalid_0) invalid_response_1, inv_resp_code_1 = api.login(params=params_invalid_1) valid_response, v_resp_code = api.login(params=params_valid) assert inv_resp_code_0 == 400, str(inv_resp_code_0) + invalid_response_0 assert inv_resp_code_1 == 400, str(inv_resp_code_1) + invalid_response_1 assert v_resp_code == 200, str(v_resp_code) + valid_response if result: return valid_response, v_resp_code else: print "test[test_auth] finished"