Exemplo n.º 1
0
def known_hosts_instance1(tmpdir_factory):
    path = str(tmpdir_factory.mktemp('known_hosts').join('hosts.json'))
    print('KNOWN HOSTS PATH:', path)
    store = keystore.KnownHostsStore(path)
    store.add(host_pair1['addr'], host_pair1['key'])
    store.add(host_pair2['addr'], host_pair2['key'])
    return store
Exemplo n.º 2
0
def test_known_hosts_with_same_path(known_hosts_instance1):
    '''Reading from the same path should fetch the same keys'''
    key1 = known_hosts_instance1.serverkey(host_pair1['addr'])
    key2 = known_hosts_instance1.serverkey(host_pair2['addr'])

    host = keystore.KnownHostsStore(known_hosts_instance1.filename)
    assert host.serverkey(host_pair1['addr']) == key1
    assert host.serverkey(host_pair2['addr']) == key2