Skip to content

Commit 811098f

Browse files
author
Tellef Kydland
committed
adding a test and removeing some unused functionimports
1 parent fba8bf7 commit 811098f

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/field_manager_api/utils/automatic_datarapport.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from selenium import webdriver
66
from selenium.webdriver.chrome.service import Service
77
from webdriver_manager.chrome import ChromeDriverManager
8-
from field_manager_api.methods.get_methods import get_methods, Method
8+
from field_manager_api.methods.get_methods import Method
99

1010

1111
class WordDocReport:

tests/test_fieldmanager_api.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import pytest
2+
from field_manager_api.field_manager import FieldManagerAPI
3+
4+
5+
def test_set_token_permission_error():
6+
fm = FieldManagerAPI()
7+
token = "your_invalid_token" # Use an invalid or expired token
8+
fm.set_token(token)
9+
10+
# Ensure that the PermissionError is raised when fm.get_projects is called
11+
with pytest.raises(
12+
PermissionError, match="Token authorization failed \(401 Unauthorized\)"
13+
):
14+
fm.get_projects()

0 commit comments

Comments
 (0)