Skip to content

Commit 7427b2a

Browse files
author
Ashutosh619-sudo
committed
added tests
1 parent 69957fe commit 7427b2a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/test_workspaces/test_tasks.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
post_to_integration_settings,
2424
run_sync_schedule,
2525
schedule_sync,
26+
sync_org_settings,
2627
trigger_email_notification,
2728
update_workspace_name,
2829
)
@@ -824,3 +825,35 @@ def test_update_workspace_name_invalid_token(db, mocker):
824825
side_effect=Exception('General error')
825826
)
826827
update_workspace_name(1, 'Bearer access_token')
828+
829+
830+
def test_sync_org_settings(db, mocker):
831+
"""
832+
Test sync org settings
833+
"""
834+
workspace_id = 1
835+
workspace = Workspace.objects.get(id=workspace_id)
836+
workspace.org_settings = {}
837+
workspace.save()
838+
839+
mock_platform = mocker.patch('apps.workspaces.tasks.PlatformConnector')
840+
mock_platform.return_value.org_settings.get.return_value = {
841+
'regional_settings': {
842+
'locale': {
843+
'date_format': 'DD/MM/YYYY',
844+
'timezone': 'Asia/Kolkata'
845+
}
846+
}
847+
}
848+
849+
sync_org_settings(workspace_id=workspace_id)
850+
851+
workspace.refresh_from_db()
852+
assert workspace.org_settings == {
853+
'regional_settings': {
854+
'locale': {
855+
'date_format': 'DD/MM/YYYY',
856+
'timezone': 'Asia/Kolkata'
857+
}
858+
}
859+
}

0 commit comments

Comments
 (0)