plexus.dashboard.api.models.test_score module
Test cases for Score model configuration pull and push functionality.
These tests cover: - Pulling configurations from API to local files - Pushing local configurations back to API as new versions - Version conflict detection and content comparison - Error handling for various failure scenarios
- class plexus.dashboard.api.models.test_score.MockAPIClient
Bases:
objectMock API client for testing Score configuration methods.
- __init__()
- execute(query, variables=None)
Mock execute method that returns pre-configured responses.
- class plexus.dashboard.api.models.test_score.TestScoreConfiguration(methodName='runTest')
Bases:
TestCaseTest cases for Score configuration pull/push functionality.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- setUp()
Set up test fixtures.
- tearDown()
Clean up test fixtures.
- test_error_handling_api_failures(mock_get_scorecard, mock_get_path)
Test error handling for various API failure scenarios.
- test_get_champion_configuration_yaml_no_champion()
Test get_champion_configuration_yaml when no champion version exists.
- test_get_champion_configuration_yaml_no_client()
Test get_champion_configuration_yaml fails without API client.
- test_get_champion_configuration_yaml_no_configuration()
Test get_champion_configuration_yaml when version has no configuration.
- test_get_champion_configuration_yaml_success()
Test get_champion_configuration_yaml with successful retrieval.
- test_get_local_configuration_path_lookup_scorecard(mock_get_scorecard)
Test getting local path when scorecard name needs to be looked up.
- test_get_local_configuration_path_no_client()
Test getting local path fails without API client when lookup needed.
- test_get_local_configuration_path_with_scorecard_name(mock_get_scorecard)
Test getting local path when scorecard name is provided.
- test_pull_configuration_no_champion_version()
Test pull configuration when no champion version exists.
- test_pull_configuration_no_client()
Test pull configuration fails without API client.
- test_pull_configuration_success(mock_get_scorecard)
Test successful configuration pull.
- test_push_configuration_file_not_found()
Test push configuration fails when local file doesn’t exist.
- test_push_configuration_no_changes()
Test push configuration skips when no changes detected.
- test_push_configuration_no_client()
Test push configuration fails without API client.
- test_push_configuration_success()
Test successful configuration push with content changes.
- test_yaml_content_cleaning()
Test that metadata comments are properly stripped during push.
- class plexus.dashboard.api.models.test_score.TestScoreVersionCreation(methodName='runTest')
Bases:
TestCaseTest cases for Score.create_version_from_yaml() - the foundational string-based method.
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- setUp()
Set up test fixtures.
- test_create_version_from_yaml_api_error()
Test version creation handles API errors gracefully.
- test_create_version_from_yaml_champion_update_failure()
Test handling when version creates but champion update fails.
- test_create_version_from_yaml_default_note()
Test that default note is used when none provided.
- test_create_version_from_yaml_invalid_yaml()
Test version creation fails with invalid YAML.
- test_create_version_from_yaml_no_changes()
Test version creation skipped when content hasn’t changed.
- test_create_version_from_yaml_no_client()
Test version creation fails without API client.
- test_create_version_from_yaml_no_current_champion()
Test version creation when no current champion version exists.
- test_create_version_from_yaml_success()
Test successful version creation from YAML string.
- test_create_version_from_yaml_version_creation_failure()
Test handling of version creation API failure.
- test_create_version_from_yaml_whitespace_handling()
Test that YAML content whitespace is properly handled.