]> Nutra Git (v1) - nutratech/cli.git/commitdiff
wip test ApiClient
authorShane Jaroch <chown_tee@proton.me>
Fri, 19 Apr 2024 18:01:07 +0000 (14:01 -0400)
committerShane Jaroch <chown_tee@proton.me>
Fri, 19 Apr 2024 18:01:07 +0000 (14:01 -0400)
tests/services/test_api.py

index f69928c272dccf2b5e7561eedfb82c4181157b68..5b33e9b0cb63e10fb8e4a3900a1c1fa9dc29fedd 100644 (file)
@@ -4,6 +4,8 @@ Created on Fri Apr 12 16:14:03 2024
 
 @author: shane
 """
+import unittest
+
 import pytest
 import requests_mock as r_mock
 
@@ -27,3 +29,20 @@ def test_cache_mirrors_failing_mirrors_return_empty_string(
     for url in URLS_API:
         requests_mock.get(url, status_code=503)
     assert cache_mirrors() == str()
+
+class TestApiClient(unittest.TestCase):
+    """Test the ApiClient class."""
+
+        def test_post(self) -> None:
+            """Test the post method."""
+            with r_mock.Mocker() as m:
+                m.post("https://api.nutra.tk/endpoint", status_code=200)
+                client = cache_mirrors()
+                assert client.post("endpoint", {}) is not None
+
+        def test_post_bug(self) -> None:
+            """Test the post_bug method."""
+            with r_mock.Mocker() as m:
+                m.post("https://api.nutra.tk/endpoint", status_code=200)
+                client = cache_mirrors()
+                assert client.post_bug({}) is not None
\ No newline at end of file