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

Function test_keypair_from_memory

test/test_credentials.py:121–137  ·  view source on GitHub ↗
(
    tmp_path: Path, pygit2_empty_key: tuple[Path, str, str]
)

Source from the content-addressed store, hash-verified

119@utils.requires_network
120@utils.requires_ssh
121def test_keypair_from_memory(
122 tmp_path: Path, pygit2_empty_key: tuple[Path, str, str]
123) -> None:
124 url = 'ssh://git@github.com/pygit2/empty'
125 with pytest.raises(pygit2.GitError):
126 pygit2.clone_repository(url, tmp_path)
127
128 prv, pub, secret = pygit2_empty_key
129 with open(prv) as f:
130 prv_mem = f.read()
131
132 with open(pub) as f:
133 pub_mem = f.read()
134
135 keypair = pygit2.KeypairFromMemory('git', pub_mem, prv_mem, secret)
136 callbacks = pygit2.RemoteCallbacks(credentials=keypair)
137 pygit2.clone_repository(url, tmp_path, callbacks=callbacks)
138
139
140def test_callback(testrepo: Repository) -> None:

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…