Skip to content

Commit

Permalink
Reactivate query tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gwehrle committed Dec 4, 2024
1 parent c42e534 commit 541a2b8
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ version = "0.0.1"
[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"

[compat]
HTTP = "1.10.8"
Mocking = "0.8.1"
Preferences = "1.4.3"
TimeZones = "1.19.0"
URIs = "1.5.1"
Expand Down
3 changes: 2 additions & 1 deletion src/Overpass.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ using HTTP
using URIs
using Dates
using TimeZones
using Mocking

export query, set_endpoint, status, turbo_url

Expand Down Expand Up @@ -88,7 +89,7 @@ end
Sets or resets the Overpass API endpoint for all queries.
# Arguments
- `endpoint::Union{Nothing, String}`: The Overpass API endpoint URL.
- `endpoint::Union{Nothing, String}`: The Overpass API endpoint URL.
Must end with a trailing slash. If set to `nothing`, the default endpoint is restored.
# Returns
Expand Down
3 changes: 2 additions & 1 deletion src/shortcuts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ Replaces `{{date}}` shortcuts in the query with the current or calculated date.
function replace_date_shortcuts(query::AbstractString)::AbstractString
if occursin(r"(?i)\{\{\s*?date", query)
# Get the current date and time
current_date = now(tz"UTC")
# @mock to fixate date in tests. Has no effect here.
current_date = @mock now(tz"UTC")

# Map string units to Dates.Period constructors
period_map = Dict(
Expand Down
Binary file added test/HTTP/op-query-date-bbox.bson
Binary file not shown.
Binary file modified test/HTTP/op-query-date.bson
Binary file not shown.
Binary file added test/HTTP/op-query-different-dates.bson
Binary file not shown.
13 changes: 12 additions & 1 deletion test/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.11.1"
manifest_format = "2.0"
project_hash = "6fc63005bc4ee24c01f5dc27a601f5bdc6c5c3b3"
project_hash = "871125b21c1da9a85e477dbc4b202688291e9123"

[[deps.Aqua]]
deps = ["Compat", "Pkg", "Test"]
Expand Down Expand Up @@ -84,6 +84,11 @@ git-tree-sha1 = "dcb08a0d93ec0b1cdc4af184b26b591e9695423a"
uuid = "460bff9d-24e4-43bc-9d9f-a8973cb893f4"
version = "0.1.10"

[[deps.ExprTools]]
git-tree-sha1 = "27415f162e6028e81c72b82ef756bf321213b6ec"
uuid = "e2ba6199-217a-4e67-a87a-7c52f15ade04"
version = "0.1.10"

[[deps.FileIO]]
deps = ["Pkg", "Requires", "UUIDs"]
git-tree-sha1 = "82d8afa92ecf4b52d78d869f038ebfb881267322"
Expand Down Expand Up @@ -217,6 +222,12 @@ version = "1.4.1"
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
version = "1.11.0"

[[deps.Mocking]]
deps = ["Compat", "ExprTools"]
git-tree-sha1 = "2c140d60d7cb82badf06d8783800d0bcd1a7daa2"
uuid = "78c3b35d-d492-501b-9361-3d52fe80e533"
version = "0.8.1"

[[deps.MozillaCACerts_jll]]
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
version = "2023.12.12"
Expand Down
1 change: 1 addition & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
BrokenRecord = "bdd55f5b-6e67-4da1-a080-6086e55655a0"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3"
Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

0 comments on commit 541a2b8

Please sign in to comment.