OCL API 2

Build: #1856 failed

Job: Run tests failed

Stages & jobs

  1. Build

  2. Test

  3. Deploy for testing

    Requires a user to start manually
  4. Release

    Requires a user to start manually

Job result summary

Completed
Duration
11 minutes
Agent
xiao.openmrs.org
Revision
4f6e5b9dea8c716b7fdf028e2b2b8cbcb5ffbcec 4f6e5b9dea8c716b7fdf028e2b2b8cbcb5ffbcec
Fixed in
#1857 (Code changes detected)
No failed test found. A possible compilation error occurred.

Error summary

The build generated some errors. See the full build log for more details.

    test_expand ... ok
    test_public_can_find_globally ... ok
    test_public_can_find_globally_without_compose ... ok
    test_public_can_view ... ok
    test_unable_to_represent_as_fhir ... Traceback (most recent call last):
  File "/code/core/value_sets/serializers.py", line 253, in to_representation
    IdentifierSerializer.include_ocl_identifier(instance.uri, RESOURCE_TYPE, rep)
  File "/code/core/common/serializers.py", line 141, in include_ocl_identifier
    return IdentifierSerializer.parse_identifier(ident)
  File "/code/core/common/serializers.py", line 88, in parse_identifier
    raise ValidationError(
rest_framework.exceptions.ValidationError: [ErrorDetail(string='Identifier must be in a format: /{owner_type}/{owner_id}/{resourceType}/{resource_id}/, given: /invalid/uri', code='invalid')]
Failed to represent "/invalid/uri" as ValueSet
ok
    test_update_with_compose ... ok
    test_validate_code ... ok
    test_validate_code_globally ... ok
    test_validate_code_globally_negative ... ok
    test_validate_code_globally_via_post ... ok
    test_validate_code_negative ... ok
core.tasks.tests.UtilsTest
    test_wait_until_task_complete_finished ... ok
    test_wait_until_task_complete_pending ... ok

======================================================================
FAIL: test_add_user (core.common.tests.OIDCAuthServiceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/unittest/mock.py", line 1370, in patched
    return func(*newargs, **newkeywargs)
  File "/code/core/common/tests.py", line 1216, in test_add_user
    post_mock.assert_called_once_with(
  File "/usr/local/lib/python3.10/unittest/mock.py", line 931, in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
  File "/usr/local/lib/python3.10/unittest/mock.py", line 919, in assert_called_with
    raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: post('/admin/realms/ocl/users', json={'enabled': True, 'emailVerified': True, 'firstName': 'First-26', 'lastName': 'Last-26', 'email': 'email26@test.com', 'username': 'username', 'credentials': <ANY>}, verify=False, headers={'Authorization': 'Bearer token'})
Actual: post('http://keycloak:8080/admin/realms/ocl/users', json={'enabled': True, 'emailVerified': True, 'firstName': 'First-26', 'lastName': 'Last-26', 'email': 'email26@test.com', 'username': 'username', 'credentials': [{'type': 'password', 'hashedSaltedValue': 'e2WdsfGUNZu89jIp8FxFaaHdkJ/k7iKplaH+wcbxlng=', 'algorithm': 'pbkdf2-sha256', 'hashIterations': 600000, 'salt': 'YVRvSXA0Skd1bVdKNmVjUURNZk9vSw==', 'temporary': False}]}, verify=False, headers={'Authorization': 'Bearer token'})

======================================================================
FAIL: test_exchange_code_for_token (core.common.tests.OIDCAuthServiceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/unittest/mock.py", line 1370, in patched
    return func(*newargs, **newkeywargs)
  File "/code/core/common/tests.py", line 1174, in test_exchange_code_for_token
    post_mock.assert_called_once_with(
  File "/usr/local/lib/python3.10/unittest/mock.py", line 931, in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
  File "/usr/local/lib/python3.10/unittest/mock.py", line 919, in assert_called_with
    raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: post('/realms/ocl/protocol/openid-connect/token', data={'grant_type': 'authorization_code', 'client_id': 'client-id', 'client_secret': 'client-secret', 'code': 'code', 'redirect_uri': 'http://localhost:4000'})
Actual: post('http://keycloak:8080/realms/ocl/protocol/openid-connect/token', data={'grant_type': 'authorization_code', 'client_id': 'client-id', 'client_secret': 'client-secret', 'code': 'code', 'redirect_uri': 'http://localhost:4000'})

======================================================================
FAIL: test_get_admin_token (core.common.tests.OIDCAuthServiceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/unittest/mock.py", line 1370, in patched
    return func(*newargs, **newkeywargs)
  File "/code/core/common/tests.py", line 1192, in test_get_admin_token
    post_mock.assert_called_once_with(
  File "/usr/local/lib/python3.10/unittest/mock.py", line 931, in assert_called_once_with
    return self.assert_called_with(*args, **kwargs)
  File "/usr/local/lib/python3.10/unittest/mock.py", line 919, in assert_called_with
    raise AssertionError(_error_message()) from cause
AssertionError: expected call not found.
Expected: post('/realms/master/protocol/openid-connect/token', data={'grant_type': 'password', 'username': 'username', 'password': 'password', 'client_id': 'admin-cli'}, verify=False)
Actual: post('http://keycloak:8080/realms/master/protocol/openid-connect/token', data={'grant_type': 'password', 'username': 'username', 'password': 'password', 'client_id': 'admin-cli'}, verify=False)

======================================================================
FAIL: test_get_login_redirect_url (core.common.tests.OIDCAuthServiceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/code/core/common/tests.py", line 1152, in test_get_login_redirect_url
    self.assertEqual(
AssertionError: 'http://localhost:8080/realms/ocl/protocol[123 chars]4000' != '/realms/ocl/protocol/openid-connect/auth?[102 chars]4000'
- http://localhost:8080/realms/ocl/protocol/openid-connect/auth?response_type=code id_token&client_id=client-id&state=state&nonce=nonce&redirect_uri=http://localhost:4000
? ---------------------
+ /realms/ocl/protocol/openid-connect/auth?response_type=code id_token&client_id=client-id&state=state&nonce=nonce&redirect_uri=http://localhost:4000

======================================================================
FAIL: test_get_logout_redirect_url (core.common.tests.OIDCAuthServiceTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/code/core/common/tests.py", line 1159, in test_get_logout_redirect_url
    self.assertEqual(
AssertionError: 'http://localhost:8080/realms/ocl/protocol[93 chars]4000' != '/realms/ocl/protocol/openid-connect/logou[72 chars]4000'
- http://localhost:8080/realms/ocl/protocol/openid-connect/logout?id_token_hint=id-token-hint&post_logout_redirect_uri=http://localhost:4000
? ---------------------
+ /realms/ocl/protocol/openid-connect/logout?id_token_hint=id-token-hint&post_logout_redirect_uri=http://localhost:4000

----------------------------------------------------------------------
Ran 800 tests in 599.494s

FAILED (failures=5)
Preserving test database for alias 'default' ('test_postgres')...
1
Stopping ocl-oclapi2-rt_db_1 ...
Stopping ocl-oclapi2-rt_es_1 ...
Stopping ocl-oclapi2-rt_db_1 ... done
Stopping ocl-oclapi2-rt_es_1 ... done
Removing ocl-oclapi2-rt_db_1 ...
Removing ocl-oclapi2-rt_es_1 ...
Removing ocl-oclapi2-rt_es_1 ... done
Removing ocl-oclapi2-rt_db_1 ... done
Removing network ocl-oclapi2-rt_default
Removing volume ocl-oclapi2-rt_postgres-data
Removing volume ocl-oclapi2-rt_es-data
Removing volume ocl-oclapi2-rt_redis-data