evalquiz_material_server.tests package
Submodules
evalquiz_material_server.tests.test_server_component module
- evalquiz_material_server.tests.test_server_component.calculate_combined_file_hash(material_upload_data: List[MaterialUploadData]) str [source]
Calculated the hash for a partitioned upload, as if it was one file.
- Parameters:
material_upload_data (List[MaterialUploadData]) – List of MaterialUploadData containing LectureMaterial at the first index followed by binary data.
- Returns:
Calculated hash.
- Return type:
str
- evalquiz_material_server.tests.test_server_component.delete_all_files_in_folder(folder_path: Path) None [source]
Deletes all files in a folder, non-recursive.
- Parameters:
folder_path (Path) – Path to the folder.
- evalquiz_material_server.tests.test_server_component.file_upload_cleanup(material_storage_path: Path) None [source]
Deletes files that were uploaded for test purposes.
- Parameters:
material_storage_path (Path) – The path were the uploaded files are stored.
- evalquiz_material_server.tests.test_server_component.material_server_service() Generator[MaterialServerService, None, None] [source]
Pytest fixture of MaterialServerService. Initializes PathDictionaryController with custom test database. Test database is emptied before tests are executed. Cleans up created files after test execution that uses this fixture.
- Yields:
Generator[MaterialServerService, None, None] – Generator with one MaterialServerService element. Yielded until file cleanup.
- evalquiz_material_server.tests.test_server_component.prepare_material_upload_data() list[evalquiz_proto.shared.generated.MaterialUploadData] [source]
Data preparation function to create example upload data.
- Returns:
A list with MaterialUploadData elements, containing a LectureMaterial at the first index and binary data of an example file.
- async evalquiz_material_server.tests.test_server_component.test_client_upload_material(material_server_service: MaterialServerService) None [source]
Tests MaterialServerService upload_material method with client-server connection.
- Parameters:
material_server_service (MaterialServerService) – Pytest fixture of MaterialServerService
- async evalquiz_material_server.tests.test_server_component.test_client_upload_material_multiple_binaries(material_server_service: MaterialServerService) None [source]
Tests MaterialServerService upload_material method with a partitioned binary that is sent in multiple gRPC stream packets. The partitioned binary is combined to validate the correctness of the received file by the server. A combined file hash is calculated to test the correctness of the received file.
- Parameters:
material_server_service (MaterialServerService) – Pytest fixture of MaterialServerService
- evalquiz_material_server.tests.test_server_component.test_pymongo_connection() None [source]
Tests if connection to database can be established.
- async evalquiz_material_server.tests.test_server_component.test_server_get_material(material_server_service: MaterialServerService) None [source]
Tests MaterialServerService get_material method with client-server connection.
- Parameters:
material_server_service (MaterialServerService) – Pytest fixture of MaterialServerService
- async evalquiz_material_server.tests.test_server_component.test_server_upload_material(material_server_service: MaterialServerService) None [source]
Tests MaterialServerService upload_material method.
- Parameters:
material_server_service (MaterialServerService) – Pytest fixture of MaterialServerService
- async evalquiz_material_server.tests.test_server_component.to_async_iter(input: Iterable[Any]) AsyncGenerator[Any, None] [source]
Helper function to create asynchronous iterator of an Iterable object, for example a list.
- Parameters:
input – The Iterable object
- Returns:
An asynchronous generator with the contents of the Iterable object.