Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctifs pour OTP 26+ #4286

Merged
merged 12 commits into from
Nov 12, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ defmodule Datagouvfr.Client.DiscussionTest do
{"content-type", "application/json"}
]

assert body == ~s({"comment":"#{comment}","subject":{"class":"Dataset","id":"#{datagouv_id}"},"title":"#{title}"})
assert Jason.decode!(body) ==
Jason.decode!(
~s({"comment":"#{comment}","subject":{"class":"Dataset","id":"#{datagouv_id}"},"title":"#{title}"})
)

thbar marked this conversation as resolved.
Show resolved Hide resolved
json(%{"title" => title, "discussion" => [%{"content" => comment}]}, status: 201)
end)

Expand Down
32 changes: 20 additions & 12 deletions apps/shared/test/validation/gbfs_validator_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,25 @@ defmodule GBFSValidatorTest do
assert logs =~ "impossible to query GBFS Validator"
end

test "can encode summary" do
assert """
{"errors_count":0,"has_errors":false,"validator":"validator_module","validator_version":"31c5325","version_detected":"1.1","version_validated":"1.1"}\
""" ==
Jason.encode!(%Summary{
errors_count: 0,
has_errors: false,
version_detected: "1.1",
version_validated: "1.1",
validator_version: "31c5325",
validator: :validator_module
})
test "can encode and decode summary" do
encoded_summary =
Jason.encode!(%Summary{
errors_count: 0,
has_errors: false,
version_detected: "1.1",
version_validated: "1.1",
validator_version: "31c5325",
validator: :validator_module
})

assert Jason.decode!(encoded_summary) == %{
"errors_count" => 0,
"has_errors" => false,
# NOTE: the serialized atom does not come back as an atom
"validator" => "validator_module",
"validator_version" => "31c5325",
"version_detected" => "1.1",
"version_validated" => "1.1"
}
end
end
5 changes: 4 additions & 1 deletion apps/transport/lib/jobs/gtfs_rt_metadata.ex
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ defmodule Transport.Jobs.GTFSRTMetadataJob do
["service_alerts", "vehicle_positions"]
"""
def present_entities(count_entities) do
count_entities |> Map.filter(fn {_, v} -> v > 0 end) |> Enum.map(fn {k, _} -> Atom.to_string(k) end)
count_entities
|> Map.filter(fn {_, v} -> v > 0 end)
|> Enum.map(fn {k, _} -> Atom.to_string(k) end)
|> Enum.sort()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ce qui change c'est le sort à la fin, le reste est du reformattage.

end

@spec process_feed({:error, any} | {:ok, TransitRealtime.FeedMessage.t()}, DB.Resource.t()) :: any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ defmodule TransportWeb.Backoffice.CacheLiveTest do
%{"Clé" => "foo", "TTL" => "Pas de TTL"}
] = extract_data_from_html(render(view))

assert_in_delta ttl |> String.replace([" ", "ms"], "") |> String.to_integer(), ttl_ms, 10
assert_in_delta ttl |> String.replace([" ", "ms"], "") |> String.to_integer(), ttl_ms, 30
thbar marked this conversation as resolved.
Show resolved Hide resolved
end
end
2 changes: 1 addition & 1 deletion apps/unlock/test/enforce_ttl_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ defmodule Unlock.EnforceTTLTest do
cache_put("no_prefix")

# initially, the list of proxy cache keys should include only 2 entries
assert ["resource:with_ttl", "resource:no_ttl"] == cache_keys()
assert ["resource:no_ttl", "resource:with_ttl"] == cache_keys() |> Enum.sort()

# this is expected to remove bogus entries (the ones without a TTL),
# which would otherwise remain "available but stale" forever
Expand Down
2 changes: 1 addition & 1 deletion apps/unlock/test/shared_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ defmodule Unlock.SharedTest do
cache_put(cache_key("no_ttl"))
cache_put("no_prefix")

assert ["resource:with_ttl", "resource:no_ttl"] == cache_keys()
assert ["resource:no_ttl", "resource:with_ttl"] == cache_keys() |> Enum.sort()
end
end