def get_users_in_radius(): user_list = bpdts.get_users() if "miles" in request.args: try: miles = float(request.args["miles"]) except ValueError: return jsonify(error="miles must be a valid float"), 400 else: miles = 50 return jsonify(geocoding.users_in_radius(user_list, miles)), 200
def test_exact_radius(self): user_list = [EXACT_USER] result = geocoding.users_in_radius(user_list, RADIUS) self.assertEqual(len(result), 1)
def test_multiple_users(self): user_list = [VALID_USER, INVALID_USER, EXACT_USER] result = geocoding.users_in_radius(user_list, RADIUS) self.assertEqual(len(result), 2)
def test_not_radius(self): user_list = [INVALID_USER] result = geocoding.users_in_radius(user_list, RADIUS) self.assertEqual(len(result), 0)