tests.test_hear_server
Module Contents
Classes
Test suite for McastServer functionality. |
|
Test suite for validating HearUDPHandler functionality. |
Data
API
- tests.test_hear_server.__module__[source]
‘tests’
- class tests.test_hear_server.McastHearTestSuite(methodName='runTest')[source][source]
Bases:
context.BasicUsageTestSuite- __module__[source]
‘tests.test_hear_server’
- __name__[source]
‘tests.test_hear_server.McastHearTestSuite’
- class tests.test_hear_server.McastServerTestSuite(methodName='runTest')[source][source]
Bases:
tests.test_hear_server.McastHearTestSuiteTest suite for McastServer functionality.
This suite verifies the server’s behavior in handling various types of requests, error conditions, and resource management.
Attributes: module (str): Module identifier name (str): Full class name
Initialization
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.
- __module__[source]
‘tests.test_hear_server’
- __name__[source]
‘tests.test_hear_server.McastServerTestSuite’
- test_handle_error_without_stop_in_request() None[source][source]
Test McastServer.handle_error with a non-STOP request.
Verifies that the server properly handles requests without the STOP command and cleans up resources.
- test_handle_error_with_none_request() None[source][source]
Test the behavior of the handle_error method when provided with a None request.
This test verifies that when the handle_error method is called with None as the request, the method should handle the error gracefully without raising exceptions. The test checks that the request remains None after the error handling.
Verifies that: 1. The random port number is not None and is an integer. 2. The McastServer initializes correctly with the specified server address and handler. 3. The handle_error method can process a None request without raising an error.
Fail Fixture: The test will fail if the handle_error method does not handle the None request correctly or if any unexpected exceptions are raised during the process.
Raises: AssertionError: If the port number is None or not an integer. Exception: If any unexpected error occurs during processing.
- class tests.test_hear_server.HearUDPHandlerTestSuite(methodName='runTest')[source][source]
Bases:
tests.test_hear_server.McastHearTestSuiteTest suite for validating HearUDPHandler functionality.
This suite tests the behavior of the UDP handler with various input combinations, including edge cases with None data and sockets.
Attributes: module (str): Module identifier name (str): Full class name
Initialization
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.
- __module__[source]
‘tests.test_hear_server’
- __name__[source]
‘tests.test_hear_server.HearUDPHandlerTestSuite’
- test_handle_with_none_data_and_sock() None[source][source]
Test the behavior of the HearUDPHandler when provided with None data and socket.
This test verifies that when the handler is initialized with None for both the request and the socket, it should return early without processing. The test checks that the handler’s return value is None, indicating that no further action was taken.
Verifies that: 1. The random port number is not None and is an integer. 2. The handler initializes correctly with None request and None socket. 3. The resulting handler returns None when handling with None request and None socket.
Fail Fixture: The test will fail if the handler does not return None when initialized with the specified parameters.
Raises: AssertionError: If the port number is None or not an integer.
- test_handle_with_data_none_sock() None[source][source]
Test the behavior of the HearUDPHandler when provided with a None inputs.
This test verifies that when the handler is initialized with a No-Op request and None socket, it should return early without processing. The test checks that the handler’s return value is None, indicating that no further action was taken.
Verifies that: 1. That the random port number is not None and is an integer. 2. The handler initializes at all with a request and a None socket. 3. The resulting handler returns None when handling with None request and None socket.
Fail Fixture: The test will fail if the handler does not return None when initialized with the specified parameters.
Raises: AssertionError: If the port number is None or not an integer.
- test_handle_with_valid_data_and_sock() None[source][source]
Test the behavior of the HearUDPHandler when provided with valid data and socket.
This test verifies that when the handler is initialized with a valid request and a valid socket, it should process the message correctly. The test checks that the handler’s return value is None, indicating successful processing.
Verifies that: 1. The random port number is not None and is an integer. 2. The handler initializes correctly with a valid request and socket. 3. The resulting handler processes the message without errors.
Fail Fixture: The test will fail if the handler does not return None when handling the valid request and socket.
Raises: AssertionError: If the port number is None or not an integer. Exception: If any unexpected error occurs during processing.