devices.tests.test_models.test_remote_device_credential

Tests for the RemoteDeviceCredential model.

Functions

test_create_remote_device_credential_from_tls_client_credential(...)

Test the creation of a RemoteDeviceCredentialDownloadModel instance using the tls_client_credential fixture.

test_save_generates_otp_if_not_set(...)

Test that save generates a new OTP if no OTP is set.

test_save_does_not_modify_existing_otp(...)

Test that save does not modify the OTP if it is already set.

test_check_token_valid(...)

Test that check_token returns True for a valid token within the validity period.

test_check_token_missing_token(...)

Test that check_token returns False if no token is set.

test_check_token_wrong_token(...)

Test that check_token returns False for an incorrect token.

test_check_token_expired(...)

Test that check_token returns False for an expired token.

test_check_otp_valid(...)

Test that check_otp returns True for a valid OTP and invalidates it afterward.

test_check_otp_invalid(...)

Test that check_otp returns False for an invalid OTP.

test_check_otp_exceed_max_attempts(...)

Test that the OTP is invalidated after exceeding the maximum number of allowed attempts.

test_check_otp_resets_on_max_attempts(...)

Test that the object is deleted after exceeding max OTP attempts.

test_check_otp_creates_download_token(...)

Test that a valid OTP generates a download token and sets the creation time.

test_get_otp_display_valid_otp(...)

Test that get_otp_display returns the OTP in the correct format when the OTP is valid.

test_get_otp_display_invalidated_otp(...)

Test that get_otp_display returns 'OTP no longer valid' when the OTP is invalidated.

Module Contents

devices.tests.test_models.test_remote_device_credential.test_create_remote_device_credential_from_tls_client_credential(tls_client_credential_instance)[source]

Test the creation of a RemoteDeviceCredentialDownloadModel instance using the tls_client_credential fixture.

Parameters:

tls_client_credential_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_save_generates_otp_if_not_set(remote_device_credential_download_instance)[source]

Test that save generates a new OTP if no OTP is set.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_save_does_not_modify_existing_otp(remote_device_credential_download_instance)[source]

Test that save does not modify the OTP if it is already set.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_check_token_valid(remote_device_credential_download_instance)[source]

Test that check_token returns True for a valid token within the validity period.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_check_token_missing_token(remote_device_credential_download_instance)[source]

Test that check_token returns False if no token is set.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_check_token_wrong_token(remote_device_credential_download_instance)[source]

Test that check_token returns False for an incorrect token.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_check_token_expired(remote_device_credential_download_instance)[source]

Test that check_token returns False for an expired token.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_check_otp_valid(remote_device_credential_download_instance)[source]

Test that check_otp returns True for a valid OTP and invalidates it afterward.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_check_otp_invalid(remote_device_credential_download_instance)[source]

Test that check_otp returns False for an invalid OTP.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_check_otp_exceed_max_attempts(remote_device_credential_download_instance)[source]

Test that the OTP is invalidated after exceeding the maximum number of allowed attempts.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_check_otp_resets_on_max_attempts(remote_device_credential_download_instance)[source]

Test that the object is deleted after exceeding max OTP attempts.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_check_otp_creates_download_token(remote_device_credential_download_instance)[source]

Test that a valid OTP generates a download token and sets the creation time.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_get_otp_display_valid_otp(remote_device_credential_download_instance)[source]

Test that get_otp_display returns the OTP in the correct format when the OTP is valid.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None

devices.tests.test_models.test_remote_device_credential.test_get_otp_display_invalidated_otp(remote_device_credential_download_instance)[source]

Test that get_otp_display returns ‘OTP no longer valid’ when the OTP is invalidated.

Parameters:

remote_device_credential_download_instance (dict[str, Any])

Return type:

None