Skip to content

Commit 957227e

Browse files
authored
Fix: All ioet users are returned from AD (#369)
* Fix: All ioet users are returned from AD * Fix: tests workflows on PR * feat: TT-551 Applying some changes in variable name
1 parent eb5256f commit 957227e

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

.github/workflows/time-tracker-v1-on-pull-request-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
AZURE_STORAGE_ACCOUNT_KEY: ${{ steps.timeTrackerAzureVault.outputs.AZURE-STORAGE-ACCOUNT-KEY }}
5454
AZURE_STORAGE_CONNECTION_STRING: ${{ steps.timeTrackerAzureVault.outputs.AZURE-STORAGE-CONNECTION-STRING }}
5555
run: |
56-
pytest tests
56+
pytest -v
5757
- name: Test the build of the app
5858
run: |
5959
docker build .

requirements/time_tracker_api/prod.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ flake8==3.7.9
1515
WSGIserver==1.3
1616
Werkzeug==0.16.1
1717
Jinja2==2.11.3
18+
markupsafe==2.0.1
19+
itsdangerous==2.0.1
1820

1921
#WSGI server
2022
gunicorn==20.0.4

tests/commons/data_access_layer/file_stream_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import json
2+
import pytest
23

34
from commons.data_access_layer.file import FileStream
45

56
fs = FileStream("tt-common-files")
67

7-
8+
@pytest.mark.skip(reason='file not in the repository')
89
def test__get_file_stream__return_file_content__when_enter_file_name():
910
result = fs.get_file_stream("activity_test.json")
1011

tests/utils/azure_users_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,4 @@ def test_users_functions_should_returns_all_users(
264264

265265
users = AzureConnection().users()
266266

267-
assert len(users) == 0
267+
assert len(users) == 2

utils/azure_users.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,11 @@ def users(self) -> List[AzureUser]:
133133
)[1]
134134
endpoint = endpoint + skip_token_attribute + request_token
135135

136-
for i in range(len(users)):
137-
if users[i]['mail'] is None:
138-
valid_users.append(users[i])
136+
for user in users:
137+
user_emails = user['otherMails']
138+
email_domain = user_emails[0].split('@')[1]
139+
if(len(user_emails) != 0 and email_domain == 'ioet.com'):
140+
valid_users.append(user)
139141

140142
return [self.to_azure_user(user) for user in valid_users]
141143

0 commit comments

Comments
 (0)