Skip to content

Commit 08b65c5

Browse files
committed
add negative testcase of invalid token.
1 parent 9a57f81 commit 08b65c5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/test_get_uploads.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,12 @@ def test_get_upload_with_last_key(self):
2323
l = Lighthouse(os.environ.get("LIGHTHOUSE_TOKEN"))
2424
res = l.getUploads('b5f60ba0-b708-41a3-b0f2-5c808ce63b48')
2525
self.assertIsInstance(res.get("fileList"), list, "data is a list")
26-
self.assertIsInstance(res.get('totalFiles'), int, "totalFiles is an int")
26+
self.assertIsInstance(res.get('totalFiles'), int, "totalFiles is an int")
27+
28+
def test_get_upload_with_invalid_token(self):
29+
"""test get_upload function with invalid token"""
30+
parse_env()
31+
l = Lighthouse("invalid_token")
32+
with self.assertRaises(Exception) as context:
33+
l.getUploads()
34+
self.assertIn("authentication failed", str(context.exception).lower())

0 commit comments

Comments
 (0)