(testrepo: Repository)
| 138 | |
| 139 | |
| 140 | def 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 |
nothing calls this directly
no test coverage detected
searching dependent graphs…