You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python-urlgrabber/0004-test-handle-unknown-fi...

35 lines
1.2 KiB

From 2bdf588a20ee9d9175fb27a819d479284b7e5079 Mon Sep 17 00:00:00 2001
From: Michal Domonkos <mdomonko@redhat.com>
Date: Tue, 21 May 2019 14:36:36 +0200
Subject: [PATCH 4/4] test: handle unknown file content in test_retry_no_cache
---
test/test_mirror.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/test/test_mirror.py b/test/test_mirror.py
index 66cafd0..a175977 100644
--- a/test/test_mirror.py
+++ b/test/test_mirror.py
@@ -352,11 +352,16 @@ class HttpReplyCode(TestCase):
def checkfunc_read(obj):
if obj.data == b'version1':
raise URLGrabError(-1, 'Outdated version of foo')
+ elif obj.data != b'version2':
+ self.fail('Unexpected file content')
def checkfunc_grab(obj):
with open('foo') as f:
- if f.read() == 'version1':
+ data = f.read()
+ if data == 'version1':
raise URLGrabError(-1, 'Outdated version of foo')
+ elif data != 'version2':
+ self.fail('Unexpected file content')
self.process = process
self.reply = 200, b'OK'
--
2.21.0