devices.tests.test_models.test_remote_device_credential¶
Tests for the RemoteDeviceCredential model.
Functions¶
|
Test the creation of a RemoteDeviceCredentialDownloadModel instance using the tls_client_credential fixture. |
Test that save generates a new OTP if no OTP is set. |
|
Test that save does not modify the OTP if it is already set. |
|
Test that check_token returns True for a valid token within the validity period. |
|
Test that check_token returns False if no token is set. |
|
Test that check_token returns False for an incorrect token. |
|
Test that check_token returns False for an expired token. |
|
|
Test that check_otp returns True for a valid OTP and invalidates it afterward. |
Test that check_otp returns False for an invalid OTP. |
|
Test that the OTP is invalidated after exceeding the maximum number of allowed attempts. |
|
Test that the object is deleted after exceeding max OTP attempts. |
|
Test that a valid OTP generates a download token and sets the creation time. |
|
Test that get_otp_display returns the OTP in the correct format when the OTP is valid. |
|
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