예제 #1
0
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 == []
예제 #2
0
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 == []
예제 #3
0
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)]
예제 #4
0
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)]
예제 #5
0
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]
        }
예제 #6
0
def test_get_session_no_token():
    assert django.DjangoChecker().get_session().auth is None
예제 #7
0
def test_get_session():
    assert django.DjangoChecker().get_session(token="a:b").auth == ("a", "b")