-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathtest_api_wrapper.py
More file actions
45 lines (39 loc) · 1.11 KB
/
test_api_wrapper.py
File metadata and controls
45 lines (39 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# (C) 2025 GoodData Corporation
import pytest
from gooddata_pipelines.api.gooddata_api import (
API_VERSION,
ApiMethods,
)
from gooddata_pipelines.api.gooddata_api_wrapper import GoodDataApi
def test_get_base_url():
"""Test the get_base_url method with various domain inputs."""
domain = "example.com"
expected_base_url = f"example.com/api/{API_VERSION}"
result = ApiMethods._get_base_url(domain)
assert result == expected_base_url
@pytest.mark.parametrize(
"host, expected_clean_host",
[
("example.com", "https://example.com"),
(
"https://example.com",
"https://example.com",
),
(
"http://example.com",
"https://example.com",
),
("example.com/", "https://example.com"),
(
"https://example.com/",
"https://example.com",
),
(
"http://example.com/",
"https://example.com",
),
],
)
def test_get_clean_host(host, expected_clean_host):
result = GoodDataApi._get_clean_host(host)
assert result == expected_clean_host