plexus.metrics.test_calculator module

Unit tests for the metrics calculator module.

class plexus.metrics.test_calculator.TestCreateCalculatorFromEnv(methodName='runTest')

Bases: TestCase

Test cases for create_calculator_from_env function.

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.

test_create_calculator_from_env_missing_api_key()

Test creation fails when API key is missing.

test_create_calculator_from_env_missing_endpoint()

Test creation fails when endpoint is missing.

test_create_calculator_from_env_success()

Test successful creation from environment variables.

class plexus.metrics.test_calculator.TestMetricsCalculator(methodName='runTest')

Bases: TestCase

Test cases for MetricsCalculator class.

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_calculate_metrics(mock_get_count)

Test the main metrics summary calculation.

test_count_items_in_timeframe(mock_request)

Test counting items in a timeframe.

test_count_items_with_pagination(mock_request)

Test counting items with pagination.

test_count_score_results_in_timeframe(mock_request)

Test counting score results in a timeframe.

test_generate_time_buckets()

Test time bucket generation.

test_init()

Test MetricsCalculator initialization.

test_make_graphql_request_success(mock_post)

Test successful GraphQL request.

test_make_graphql_request_with_errors(mock_post)

Test GraphQL request with errors.