Vehicle profiles (Car, Camper, ...), avoid tolls/motorways, per-country vignette and toll km for a route
This commit is contained in:
1 parent
58ca871662
commit
69aa284e36
8 files changed
+328
-80
No files matched your search
+7
-7
@@ -237,14 +237,14 @@ class AppTest < Minitest::Test
|
||||
assert_equal 422, request.post("/api/isochrone", input: JSON.generate(center: [17.1, 48.1], minutes: [999]), "CONTENT_TYPE" => "application/json").status
|
||||
end
|
||||
|
||||
def test_the_vehicle_is_readable_by_anyone_but_saved_only_when_logged_in
|
||||
assert_equal 3.0, json_body(request.get("/api/vehicle"))["height"]
|
||||
vehicle = { height: 3.3, width: 2.3, length: 7, weight: 3.5 }
|
||||
assert_equal 401, request.put("/api/vehicle", params: vehicle).status
|
||||
assert_equal 3.3, json_body(request.put("/api/vehicle", params: vehicle, **logged_in_env))["height"]
|
||||
assert_equal 400, request.put("/api/vehicle", params: vehicle.merge(weight: 0), **logged_in_env).status
|
||||
def test_vehicles_are_readable_by_anyone_but_saved_only_when_logged_in
|
||||
assert_equal "Car", json_body(request.get("/api/vehicles")).first["name"]
|
||||
vehicles = JSON.generate([{ id: "car", name: "Car" }, { id: "van", name: "Van", height: 3.3 }])
|
||||
assert_equal 401, request.put("/api/vehicles", input: vehicles).status
|
||||
assert_equal 3.3, json_body(request.put("/api/vehicles", input: vehicles, **logged_in_env)).last["height"]
|
||||
assert_equal 400, request.put("/api/vehicles", input: "[]", **logged_in_env).status
|
||||
ensure
|
||||
FileUtils.rm_f(File.join(Maptool::App::DATA_DIR, "vehicle.json"))
|
||||
FileUtils.rm_f(File.join(Maptool::App::DATA_DIR, "vehicles.json"))
|
||||
end
|
||||
|
||||
def test_changes_and_exports_need_login
|
||||
|
||||
Reference in new issue
Block a user