async def test_refresh_problem_with_google(drive: DriveSource, server: SimulationServer, config: Config, time): time.advanceDay() server.setError(".*/oauth2/v4/token.*", status=510) drive.drivebackend.creds._secret = None with pytest.raises(CredRefreshGoogleError) as error: await drive.get() assert error.value.data() == {"from_google": "Google returned HTTP 510"}
async def test_resume_session_reused_on_http410( time, drive: DriveSource, config: Config, server: SimulationServer, snapshot_helper: SnapshotHelper): from_snapshot, data = await snapshot_helper.createFile() # Configure the upload to fail after the first upload chunk server.setError(".*upload/drive/v3/files/progress.*", 1, 500) with pytest.raises(GoogleInternalError): await drive.save(from_snapshot, data) # Verify a requst was made to start the upload assert server.wasUrlRequested( "/upload/drive/v3/files/?uploadType=resumable&supportsAllDrives=true") assert drive.drivebackend.last_attempt_location is not None server.urls.clear() server.match_errors.clear() data.position(0) server.setError(drive.drivebackend.last_attempt_location, 0, 410) await drive.save(from_snapshot, data)