def test_check_matches_no_pr(mocker, fixed_match): mocker.patch("raincoat.match.django.get_merge_commit_sha1", return_value=None) result = list(django.DjangoChecker().check_matches({26976: [fixed_match]}, "1.9")) assert result == []
def test_check_matches_not_merged(mocker, fixed_match): mocker.patch("raincoat.match.django.get_merge_commit_sha1", return_value="123") mocker.patch("raincoat.match.django.is_commit_in_version", return_value=False) result = list(django.DjangoChecker().check_matches({26976: [fixed_match]}, "1.9")) assert result == []
def test_check_matches(mocker, fixed_match): mocker.patch("raincoat.match.django.get_merge_commit_sha1", return_value="123") mocker.patch("raincoat.match.django.is_commit_in_version", return_value=True) result = list(django.DjangoChecker().check_matches({26976: [fixed_match]}, "1.9")) assert result == [("Ticket #26976 has been merged in Django 1.9", fixed_match)]
def test_check(mocker, fixed_match): mocker.patch("raincoat.match.django.get_merge_commit_sha1", return_value="123") mocker.patch("raincoat.match.django.is_commit_in_version", return_value=True) mocker.patch("raincoat.match.django.source.get_current_or_latest_version", return_value=(True, "1.9")) result = list(django.DjangoChecker().check([fixed_match])) assert result == [("Ticket #26976 has been merged in Django 1.9", fixed_match)]
def test_get_match_info(fixed_match, not_fixed_match): assert django.DjangoChecker().get_match_info( [fixed_match, fixed_match, not_fixed_match]) == { 27754: [not_fixed_match], 26976: [fixed_match, fixed_match] }
def test_get_session_no_token(): assert django.DjangoChecker().get_session().auth is None
def test_get_session(): assert django.DjangoChecker().get_session(token="a:b").auth == ("a", "b")