Skip to content

Commit 6107440

Browse files
authored
Merge pull request #74 from itk-dev-rpa/feature/dependencies
Feature/dependencies
2 parents 50fd2e4 + 3ffa4dd commit 6107440

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
### Changed
2323

2424
- eflyt.eflyt_case.change_tab now checks if the tab needs to be changed before doing it.
25+
- Dependenices are now only locked to major versions.
26+
- Changed test for change sap password to use dotenv.
2527

2628
## [2.5.0] - 2024-08-14
2729

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ classifiers = [
1818
]
1919
dependencies = [
2020
"pywin32 >= 306",
21-
"msal >= 1.24.1",
22-
"requests >= 2.31.0",
23-
"beautifulsoup4 >= 4.12.2",
24-
"selenium==4.16.0",
25-
"uiautomation == 2.0.18"
21+
"msal == 1.*",
22+
"requests == 2.*",
23+
"beautifulsoup4 == 4.*",
24+
"selenium == 4.*",
25+
"uiautomation == 2.*"
2626
]
2727

2828
[project.urls]

tests/readme.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@ mailpit --smtp-tls-cert cert.pem --smtp-tls-key key.pem
3838
```
3939

4040
## Environment variables
41-
You need to setup a .env file in the root directory with the following parameters:
4241

42+
You need to setup a .env file in the root directory with the following parameters:
4343

4444
### SAP
4545

4646
SAP_LOGIN = 'login;password'
47+
SAP_NEW_PASSWORD = 'new password'
48+
49+
If SAP_NEW_PASSWORD is not set, the change password test is skipped.
4750

4851
### GRAPH
4952

@@ -74,4 +77,4 @@ CVR_CREDS = 'login;password'
7477
EFLYT_LOGIN = 'username,password'
7578
TEST_CPR = 'XXXXXXXXXX'
7679
TEST_CASE = '123456' # A test case with multiple current inhabitants, with relations registered
77-
TEST_CASE_NOONE = '56789' # A test case without any current inhabitants
80+
TEST_CASE_NOONE = '56789' # A test case without any current inhabitants

tests/test_sap/test_sap_login.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import os
44
import unittest
5-
from tkinter import simpledialog
65

76
from dotenv import load_dotenv, set_key
87

@@ -20,7 +19,6 @@ def setUpClass(cls) -> None:
2019
used in the following tests.
2120
"""
2221
cls.username, cls.password = os.environ['SAP_LOGIN'].split(';')
23-
cls.new_password = simpledialog.askstring("Enter new password", "Enter the new password to be used in testing the change SAP password function.\nRemember to write down the new password!\nLeave empty to skip test_change_password.")
2422

2523
def setUp(self) -> None:
2624
sap_login.kill_sap()
@@ -44,17 +42,19 @@ def test_change_password(self):
4442
Due to a limit in SAP you can only run this function once per day.
4543
If no new_password is entered in the setup, test is skipped.
4644
"""
47-
if not self.new_password:
48-
raise unittest.SkipTest("Test not run because new_password was missing.")
45+
new_password = os.getenv('SAP_NEW_PASSWORD')
46+
if not new_password:
47+
raise unittest.SkipTest("Test skipped because SAP_NEW_PASSWORD was missing.")
48+
49+
sap_login.change_password(self.username, self.password, new_password)
4950

50-
sap_login.change_password(self.username, self.password, self.new_password)
5151
# Change password for all coming tests
52-
self.password = self.new_password
53-
os.environ['SAP_LOGIN'] = f"{self.username};{self.password}"
54-
set_key(".env", 'SAP_LOGIN', self.password)
52+
self.password = new_password
53+
set_key(".env", 'SAP_LOGIN', f"{self.username};{self.password}")
54+
set_key(".env", 'SAP_NEW_PASSWORD', '')
5555

5656
with self.assertRaises(ValueError):
57-
sap_login.change_password(self.username, "Foo", self.new_password)
57+
sap_login.change_password(self.username, "Foo", new_password)
5858

5959
with self.assertRaises(ValueError):
6060
sap_login.change_password(self.username, self.password, "")

0 commit comments

Comments
 (0)