def test_create_archive_service_when_device_has_no_destination_raises_exception( self, mock_successful_connection, mock_device_service, mock_connection_manager, py42_response, ): factory = StorageServiceFactory(mock_successful_connection, mock_device_service, mock_connection_manager) py42_response.text = '{"backupUsage": []}' mock_device_service.get_by_guid.return_value = py42_response with pytest.raises(Exception): factory.create_archive_service("testguid")
def test_create_archive_service( self, mock_successful_connection, mock_device_service, mock_connection_manager ): factory = StorageServiceFactory( mock_successful_connection, mock_device_service, mock_connection_manager ) service = factory.create_archive_service("testguid", None) assert type(service) == StorageArchiveService
def test_create_archive_service_when_given_destination_guid_does_not_call_device_service( self, mock_successful_connection, mock_device_service, mock_connection_manager ): factory = StorageServiceFactory( mock_successful_connection, mock_device_service, mock_connection_manager ) service = factory.create_archive_service("testguid", destination_guid=42) assert mock_device_service.get_by_guid.call_count == 0 assert type(service) == StorageArchiveService
def test_create_archive_service(self, mock_successful_connection, mock_device_service, mock_connection_manager): factory = StorageServiceFactory(mock_successful_connection, mock_device_service, mock_connection_manager) service = factory.create_archive_service("testguid") mock_device_service.get_by_guid.assert_called_once_with( "testguid", include_backup_usage=True) assert type(service) == StorageArchiveService