def test_remove_friend(self): uid_1 = "uid_user_1" uid_2 = "uid_user_2" usecret_1 = "usecret_1" usecret_2 = "usecret_2" resp, code = self.test_login(uid=uid_1, usecret=usecret_1, result=True) assert code == 200, resp resp_dict = json.loads(resp) headers = dict() headers['token'] = resp_dict['token'] resp, code = api.on_add_friend(headers=headers, friend_uid=None) assert code == 400, str(code) + resp resp, code = api.on_add_friend(headers=headers, friend_uid="--") assert code == 400, str(code) + resp resp, code = self.test_login(uid=uid_2, usecret=usecret_2, result=True) assert code == 200, resp resp, code = api.on_remove_friend(headers=headers, friend_uid=uid_2) assert code == 200, str(code) + resp resp, code = api.on_remove_friend(headers=headers, friend_uid=uid_2) assert code == 400, str(code) + resp print "test[test_remove_friend] finished"
def route_user_add_friend(friend_uid): if request.method == 'GET': # headers headers = request.headers return api.on_add_friend(headers=headers, friend_uid=friend_uid) elif request.method == 'DELETE': # headers headers = request.headers return api.on_remove_friend(headers=headers, friend_uid=friend_uid)