How to use the pygerrit2.Anonymous function in pygerrit2

To help you get started, we’ve selected a few pygerrit2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dpursehouse / pygerrit2 / livetests.py View on Github external
def gerrit_api(request):
    """Create a Gerrit container for the given version and return an API."""
    with GerritContainer(request.param) as gerrit:
        port = gerrit.get_exposed_port(8080)
        url = "http://localhost:%s" % port
        api = GerritRestAPI(url=url, auth=Anonymous())
        _initialize(api)
        auth = HTTPBasicAuth("admin", "secret")
        api = GerritRestAPI(url=url, auth=auth)
        yield api
github dpursehouse / pygerrit2 / unittests.py View on Github external
def test_explicit_anonymous_with_netrc(self):
        """Test explicit anonymous access when credentials are in netrc."""
        with patch("pygerrit2.rest.auth._get_netrc_auth") as mock_netrc:
            mock_netrc.return_value = ("netrcuser", "netrcpass")
            auth = Anonymous()
            api = GerritRestAPI(url="http://review.example.com", auth=auth)
            assert api.auth is None
            assert not api.url.endswith("/a/")
github dpursehouse / pygerrit2 / unittests.py View on Github external
def test_explicit_anonymous_without_netrc(self):
        """Test explicit anonymous access when credentials are not in netrc."""
        with patch("pygerrit2.rest.auth._get_netrc_auth") as mock_netrc:
            mock_netrc.return_value = None
            auth = Anonymous()
            api = GerritRestAPI(url="http://review.example.com", auth=auth)
            assert api.auth is None
            assert not api.url.endswith("/a/")