keycloak_oidc = <swh.auth.pytest_plugin.KeycloackOpenIDConnectMock object at 0x7f708ae40588>
mocker = <pytest_mock.plugin.MockerFixture object at 0x7f708ae3dda0>
user_credentials = {'password': 'bar', 'username': 'foo'}
def test_auth_generate_token_ok(keycloak_oidc, mocker, user_credentials):
mock_getpass = mocker.patch("getpass.getpass")
mock_getpass.return_value = user_credentials["password"]
command = ["generate-token", user_credentials["username"]]
result = _run_auth_command(
> command, keycloak_oidc, input=f"{user_credentials['password']}\n"
)
.tox/py3/lib/python3.7/site-packages/swh/auth/tests/test_cli.py:62:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
command = ['generate-token', 'foo']
keycloak_oidc = <swh.auth.pytest_plugin.KeycloackOpenIDConnectMock object at 0x7f708ae40588>
input = 'bar\n'
def _run_auth_command(command, keycloak_oidc, input=None):
server_url = "http://keycloak:8080/keycloak/auth/"
realm_name = "realm-test"
client_id = "client-test"
result = runner.invoke(
auth,
[
"--oidc-server-url",
server_url,
"--realm-name",
realm_name,
"--client-id",
client_id,
*command,
],
input=input,
)
assert keycloak_oidc.server_url == server_url
> assert keycloak_oidc.realm_name == realm_name
E AssertionError: assert 'SoftwareHeritage' == 'realm-test'
E - realm-test
E + SoftwareHeritage
.tox/py3/lib/python3.7/site-packages/swh/auth/tests/test_cli.py:46: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Dec 19 2022, 11:40 AM