Leon4gr45 commited on
Commit
f903802
·
verified ·
1 Parent(s): 280ccae

Delete test/support/google_api_mock.ex with huggingface_hub

Browse files
Files changed (1) hide show
  1. test/support/google_api_mock.ex +0 -51
test/support/google_api_mock.ex DELETED
@@ -1,51 +0,0 @@
1
- defmodule Plausible.Google.API.Mock do
2
- @moduledoc """
3
- Mock of API to Google services.
4
- """
5
-
6
- @doc """
7
- This function uses the event:page filter (which can be passed as a query
8
- parameter into StatsController) as a hack to mock different responses.
9
- """
10
- def fetch_stats(_auth, query, _pagination, _search) do
11
- case page_filter_value(query) do
12
- ["/empty"] ->
13
- {:ok, []}
14
-
15
- ["/unsupported-filters"] ->
16
- {:error, :unsupported_filters}
17
-
18
- ["/not-configured"] ->
19
- {:error, :google_property_not_configured}
20
-
21
- ["/unexpected-error"] ->
22
- {:error, :some_unexpected_error}
23
-
24
- _ ->
25
- {:ok,
26
- [
27
- %{
28
- name: "simple web analytics",
29
- visitors: 25,
30
- impressions: 50,
31
- ctr: 37.0,
32
- position: 2.0
33
- },
34
- %{
35
- name: "open-source analytics",
36
- visitors: 15,
37
- impressions: 25,
38
- ctr: 50.0,
39
- position: 4.0
40
- }
41
- ]}
42
- end
43
- end
44
-
45
- defp page_filter_value(query) do
46
- Enum.find_value(query.filters, fn
47
- [:is, "event:page", value] -> value
48
- _ -> nil
49
- end)
50
- end
51
- end