There was an error while loading. Please reload this page.
1 parent 58dcd43 commit 498bf51Copy full SHA for 498bf51
1 file changed
tests/substack/test_api.py
@@ -1,5 +1,6 @@
1
import os
2
import unittest
3
+from unittest.mock import Mock, patch
4
5
from dotenv import load_dotenv
6
@@ -34,8 +35,10 @@ def _api_from_env() -> Api:
34
35
36
class ApiTest(unittest.TestCase):
37
def test_api_exception(self):
38
+ response = Mock(status_code=401, text="Unauthorized")
39
with self.assertRaises(SubstackAPIException):
- Api(email="", password="")
40
+ with patch("requests.Session.post", return_value=response):
41
+ Api(email="", password="")
42
43
@_e2e
44
def test_get_posts(self):
0 commit comments