Leon4gr45 commited on
Commit
077a26f
·
verified ·
1 Parent(s): 2021931

Delete test/plausible_web/controllers/api/external_stats_controller/debug_metadata_test.exs with huggingface_hub

Browse files
test/plausible_web/controllers/api/external_stats_controller/debug_metadata_test.exs DELETED
@@ -1,53 +0,0 @@
1
- defmodule PlausibleWeb.Api.ExternalController.DebugMetadataTest do
2
- alias Plausible.{IngestRepo, ClickhouseRepo}
3
- use PlausibleWeb.ConnCase
4
-
5
- describe "Debug metadata" do
6
- setup [:create_user, :create_api_key, :use_api_key]
7
-
8
- test "is saved correctly", %{conn: conn, user: user} do
9
- domain = :rand.bytes(20) |> Base.url_encode64()
10
- site = new_site(domain: domain, owner: user)
11
-
12
- query = %{
13
- "site_id" => site.domain,
14
- "date_range" => "all",
15
- "metrics" => ["visitors"]
16
- }
17
-
18
- conn =
19
- post(conn, "/api/v2/query", query)
20
-
21
- assert json_response(conn, 200)
22
-
23
- IngestRepo.query!("SYSTEM FLUSH LOGS")
24
-
25
- %{rows: [r1, r2]} =
26
- ClickhouseRepo.query!(
27
- "FROM system.query_log SELECT log_comment WHERE JSONExtractString(log_comment, 'site_domain') = {$0:String}",
28
- [site.domain]
29
- )
30
-
31
- for [unparsed_log_comment] <- [r1, r2] do
32
- decoded = Jason.decode!(unparsed_log_comment)
33
-
34
- assert_matches ^strict_map(%{
35
- # params are asserted below
36
- "params" => %{},
37
- "phoenix_action" => "query",
38
- "phoenix_controller" =>
39
- "Elixir.PlausibleWeb.Api.ExternalQueryApiController",
40
- "request_method" => "POST",
41
- "request_path" => "/api/v2/query",
42
- "site_domain" => ^site.domain,
43
- "site_id" => ^site.id,
44
- "team_id" => ^team_of(user).id,
45
- "trace_id" => _,
46
- "user_id" => ^user.id
47
- }) = decoded
48
-
49
- assert decoded["params"] == query
50
- end
51
- end
52
- end
53
- end