From 300d81d6cde8732e8d4fefc454b309be8d9c67b6 Mon Sep 17 00:00:00 2001 From: Rafid Aslam Date: Wed, 4 Jul 2018 13:26:19 +0700 Subject: [PATCH] InvalidLinkBearTest: Fix test_redirect_threshold Match the expected result with the actual result in `test_redirect_threshold()` by adding `diffs` argument. Closes https://github.com/coala/coala-bears/issues/2571 --- tests/general/InvalidLinkBearTest.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/general/InvalidLinkBearTest.py b/tests/general/InvalidLinkBearTest.py index a4f262608e..638be37716 100644 --- a/tests/general/InvalidLinkBearTest.py +++ b/tests/general/InvalidLinkBearTest.py @@ -9,9 +9,11 @@ from bears.general.InvalidLinkBear import InvalidLinkBear from bears.general.URLHeadBear import URLHeadBear from coalib.testing.LocalBearTestHelper import LocalBearTestHelper +from coalib.results.Diff import Diff from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY from coalib.results.Result import Result from coalib.settings.Section import Section +from coala_utils.ContextManagers import prepare_file def custom_matcher(request): @@ -253,6 +255,12 @@ def test_redirect_threshold(self): self.check_validity(self.uut, long_url_redirect, settings={'follow_redirects': 'true'}) + with prepare_file(short_url_redirect, None, + create_tempfile=False) as (lines, _): + diff = Diff(lines) + diff.modify_line(2, + ' http://httpbin.org/get\n') + self.check_results( self.uut, short_url_redirect, @@ -261,7 +269,8 @@ def test_redirect_threshold(self): 'This link redirects to http://httpbin.org/get', severity=RESULT_SEVERITY.NORMAL, line=2, - file='short_url_redirect_text' + file='short_url_redirect_text', + diffs={'short_url_redirect_text': diff}, )], settings={'follow_redirects': 'true'}, filename='short_url_redirect_text')