diff options
| author | Victor Näslund <victor@sunet.se> | 2022-11-17 22:04:24 +0100 |
|---|---|---|
| committer | Victor Näslund <victor@sunet.se> | 2022-11-17 22:04:24 +0100 |
| commit | 03735d4c6fc17193e5019d3bd595bad2ce41c61f (patch) | |
| tree | 889e5b6615f62930ef2ebd1e36616a177fca539e /tests/test_info.py | |
| parent | a276c55e8f1f7f2c5872a43485425dd85f1dfa9f (diff) | |
added tests
Diffstat (limited to 'tests/test_info.py')
| -rw-r--r-- | tests/test_info.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test_info.py b/tests/test_info.py new file mode 100644 index 0000000..ef775d7 --- /dev/null +++ b/tests/test_info.py @@ -0,0 +1,37 @@ +""" +Test our info +""" +import unittest +import json + +import requests + +from src.soc_collector.auth import load_api_keys + +BASE_URL = "https://localhost:8000" + + +class TestAddress(unittest.TestCase): + """ + Test our info + """ + + def test_info(self) -> None: + """ + Test info + """ + + api_keys = load_api_keys("data/api_keys.txt") + request_headers = {"API-KEY": api_keys[-1]} + + req = requests.get( + f"{BASE_URL}/info", + headers=request_headers, + timeout=4, + verify="./data/collector_root_ca.crt", + ) + self.assertTrue(req.status_code == 200) + data = json.loads(req.text) + self.assertTrue("Estimated document count" in data) + self.assertTrue(isinstance(data["Estimated document count"], int)) + self.assertTrue(data["Estimated document count"] >= 0) |
