test_settings_cognito.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import pytest
  2. from mock import ANY
  3. pytestmark = [pytest.mark.acceptance_cognito, pytest.mark.api, pytest.mark.settings]
  4. @pytest.mark.auth
  5. def test_auth(api_client_cognito, settings_base_endpoint):
  6. assert (
  7. 401
  8. == api_client_cognito.get(
  9. settings_base_endpoint, headers={"Authorization": None}
  10. ).status_code
  11. )
  12. def test_it_gets_settings(api_client_cognito, settings_base_endpoint, stack):
  13. # Act
  14. response = api_client_cognito.get(settings_base_endpoint)
  15. response_body = response.json()
  16. # Assert
  17. assert response.status_code == 200
  18. assert isinstance(response_body.get("Settings"), dict)
  19. assert response_body["Settings"] == {
  20. "AthenaConcurrencyLimit": ANY,
  21. "AthenaQueryMaxRetries": ANY,
  22. "DeletionTasksMaxNumber": ANY,
  23. "JobDetailsRetentionDays": ANY,
  24. "ForgetQueueWaitSeconds": ANY,
  25. "QueryExecutionWaitSeconds": ANY,
  26. "QueryQueueWaitSeconds": ANY,
  27. }
  28. assert (
  29. response.headers.get("Access-Control-Allow-Origin")
  30. == stack["APIAccessControlAllowOriginHeader"]
  31. )