Example #1
0
    def test_update_user_location(self):
        user = self._sample_user()

        with self.app_context:
            user.save()

            User.update_location(user.id, 57.062, 13.673)

            user_test = User.get_by_id(user.id)
            self.assertEqual(user_test.location[0], 57.062)
            self.assertEqual(user_test.location[1], 13.673)
            User.remove(user.id)
def update_user_location():
    log("In update_user_location method")
    lat = request.json.get('lat')
    lon = request.json.get('lon')
    user_id = g.user.id
    log("Got user details in update_user_location")

    User.update_location(user_id, lat, lon)
    log("Updated location")

    response_data = create_response_data(
        "Updated location",
        200
    )
    return jsonify(response_data), response_data['status_code']