Exemplo n.º 1
0
def test_verify_repo_existence():

    _github = GitHub(verify_repo=False)

    responses.add(responses.GET, "http://mygithub/my_org/my_repo", status=200)
    _github._verify_repo_existence("http://mygithub", "my_org", "my_repo",
                                   "my_token")

    assert len(responses.calls) == 1
Exemplo n.º 2
0
def test_verify_repo_does_not_existence():

    with patch('flow.utils.commons.printMSG') as mock_printmsg_fn:

        _github = GitHub(verify_repo=False)

        responses.add(responses.GET,
                      "http://mygithub/my_org/my_repo",
                      status=201)
        with pytest.raises(SystemExit):
            _github._verify_repo_existence("http://mygithub", "my_org",
                                           "my_repo", "my_token")

        print(str(mock_printmsg_fn.mock_calls))
        mock_printmsg_fn.assert_called_with(
            "GitHub", "_verify_repo_existence",
            "Failed to access github location "
            "http://mygithub/my_org/my_repo\r\n Response: ", "ERROR")
        assert len(responses.calls) == 1