Exemplo n.º 1
0
 def test_it_checks_if_release_number_is_properly_configured(
         assert_github_issue_no_cache: AssertGitHubIssue,
         requests_mock: MagicMock):
     set_number_of_releases_to(requests_mock,
                               CURRENT_NUMBER_OF_RELEASES - 1)
     with pytest.raises(AssertionError, match=".*improperly configured.*"):
         assert_github_issue_no_cache.current_release(
             CURRENT_NUMBER_OF_RELEASES)
Exemplo n.º 2
0
 def test_it_fails_when_new_releases_available(
         assert_github_issue_no_cache: AssertGitHubIssue,
         requests_mock: MagicMock):
     set_number_of_releases_to(requests_mock,
                               CURRENT_NUMBER_OF_RELEASES + 1)
     with pytest.raises(AssertionError, match="New release of .*"):
         assert_github_issue_no_cache.current_release(
             CURRENT_NUMBER_OF_RELEASES)
Exemplo n.º 3
0
 def test_it_shows_current_release_number_if_none_given(
         assert_github_issue_no_cache: AssertGitHubIssue,
         requests_mock: MagicMock):
     set_number_of_releases_to(requests_mock, 1)
     with pytest.raises(
             AssertionError,
             match=".*test does not have any number of releases set.*"
             "number of releases is '[0-9]+'"):
         assert_github_issue_no_cache.current_release()
Exemplo n.º 4
0
    def test_it_raises_when_status_not_200_in_releases_check(
            self, assert_github_issue_no_cache: AssertGitHubIssue,
            requests_mock: MagicMock):
        set_number_of_releases_to(requests_mock, CURRENT_NUMBER_OF_RELEASES,
                                  500)

        with pytest.raises(HTTPError,
                           match=self._GENERIC_ERROR_MESSAGE_PATTERN):
            assert_github_issue_no_cache.current_release(
                CURRENT_NUMBER_OF_RELEASES)
Exemplo n.º 5
0
def assert_github_issue_caching():
    assert_github_issue = AssertGitHubIssue(REPOSITORY_ID)

    # first call can be cache miss
    assert_github_issue.is_closed(CLOSED_ISSUE_NUMBER)
    try:
        assert_github_issue.current_release(0)
    except AssertionError:
        pass

    assert_github_issue.fixed_in("1234567890.0.0", "releases/(?P<version>.*)")

    return assert_github_issue
Exemplo n.º 6
0
 def test_it_does_not_fail_when_expected_releases_available(
         assert_github_issue_no_cache: AssertGitHubIssue,
         requests_mock: MagicMock):
     set_number_of_releases_to(requests_mock, CURRENT_NUMBER_OF_RELEASES)
     assert_github_issue_no_cache.current_release(
         CURRENT_NUMBER_OF_RELEASES)
Exemplo n.º 7
0
    def test_release_number_check_fails_when_new_releases_available(
        assert_github_issue_no_cache: AssertGitHubIssue, ):
        with pytest.raises(AssertionError, match=".*New release of .*") as ex:
            assert_github_issue_no_cache.current_release(0)

        print(ex)  # for quick grab of string for documentation
Exemplo n.º 8
0
 def test_release_check_fails_when_new_releases_available(assert_github_issue_caching: AssertGitHubIssue):
     with _timer():
         with pytest.raises(AssertionError, match=".*New release of .*"):
             assert_github_issue_caching.current_release(0)