Skip to content

Commit

Permalink
InvalidLinkBearTest: Fix test_redirect_threshold
Browse files Browse the repository at this point in the history
Match the expected result with the actual result
in `test_redirect_threshold()` by adding `diffs` argument.

Closes #2571
  • Loading branch information
refeed authored and gitmate-bot committed Jul 4, 2018
1 parent c83e4f4 commit 300d81d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/general/InvalidLinkBearTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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,
Expand All @@ -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')
Expand Down

0 comments on commit 300d81d

Please sign in to comment.