MCPcopy Create free account
hub / github.com/libgit2/pygit2 / test_callback

Function test_callback

test/test_credentials.py:140–154  ·  view source on GitHub ↗
(testrepo: Repository)

Source from the content-addressed store, hash-verified

138
139
140def test_callback(testrepo: Repository) -> None:
141 class MyCallbacks(pygit2.RemoteCallbacks):
142 def credentials(
143 self,
144 url: str,
145 username_from_url: str | None,
146 allowed_types: CredentialType,
147 ) -> Username | UserPass | Keypair:
148 assert allowed_types & CredentialType.USERPASS_PLAINTEXT
149 raise Exception("I don't know the password")
150
151 url = 'https://github.com/github/github'
152 remote = testrepo.remotes.create('github', url)
153 with pytest.raises(Exception):
154 remote.fetch(callbacks=MyCallbacks())
155
156
157@utils.requires_network

Callers

nothing calls this directly

Calls 3

fetchMethod · 0.80
MyCallbacksClass · 0.70
createMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…