def test_wrmhl_wrong_code(): data = read_fixture_file("seckey-no-pw-1.asc") key = openpgpkey_from_data(data) log.info("Running with key %r", key) # Start offering the key offer = WormholeOffer(key) info = yield offer.allocate_code() code, _ = info offer.start() receive = WormholeReceive(code + "-wrong") msg_tuple = yield receive.start() downloaded_key_data, success, message = msg_tuple assert_false(success) assert_is_not_none(message) assert_equal(message, WrongPasswordError)
def test_wrmhl(): data = read_fixture_file("seckey-no-pw-1.asc") key = openpgpkey_from_data(data) file_key_data = get_public_key_data(key.fingerprint) log.info("Running with key %r", key) # Start offering the key offer = WormholeOffer(key) info = yield offer.allocate_code() code, _ = info offer.start() receive = WormholeReceive(code) msg_tuple = yield receive.start() downloaded_key_data, success, _ = msg_tuple assert_true(success) log.info("Checking with key: %r", downloaded_key_data) assert_equal(downloaded_key_data, file_key_data)
def test_wrmhl_wrong_code(): # This should be a new, empty directory homedir = tempfile.mkdtemp() os.environ["GNUPGHOME"] = homedir key = import_key_from_file("seckey-no-pw-1.asc", homedir) log.info("Running with key %r", key) # Start offering the key offer = WormholeOffer(key) info = yield offer.allocate_code() code, _ = info offer.start() receive = WormholeReceive(code + "-wrong") msg_tuple = yield receive.start() downloaded_key_data, success, message = msg_tuple assert_false(success) assert_is_not_none(message) assert_equal(message, WrongPasswordError)
def test_wrmhl(): # This should be a new, empty directory homedir = tempfile.mkdtemp() os.environ["GNUPGHOME"] = homedir key = import_key_from_file("seckey-no-pw-1.asc", homedir) file_key_data = get_public_key_data(key.fingerprint) log.info("Running with key %r", key) # Start offering the key offer = WormholeOffer(key) info = yield offer.allocate_code() code, _ = info offer.start() receive = WormholeReceive(code) msg_tuple = yield receive.start() downloaded_key_data, success, _ = msg_tuple assert_true(success) log.info("Checking with key: %r", downloaded_key_data) assert_equal(downloaded_key_data, file_key_data)
def test_wrmhl_offline_code(): data = read_fixture_file("seckey-no-pw-1.asc") key = openpgpkey_from_data(data) file_key_data = get_public_key_data(key.fingerprint) # We assume that this channel, at execution time, is free code = "5556-penguin-paw-print" # Start offering the key offer = WormholeOffer(key) offer.allocate_code(code) offer.start() # Start receiving the key receive = WormholeReceive(code) msg_tuple = yield receive.start() downloaded_key_data, success, _ = msg_tuple assert_true(success) log.info("Checking with key: %r", downloaded_key_data) assert_equal(downloaded_key_data, file_key_data)
def test_wrmhl_offline_code(): # This should be a new, empty directory homedir = tempfile.mkdtemp() os.environ["GNUPGHOME"] = homedir key = import_key_from_file("seckey-no-pw-1.asc", homedir) file_key_data = get_public_key_data(key.fingerprint) # We assume that this channel, at execution time, is free code = u"5556-penguin-paw-print" # Start offering the key offer = WormholeOffer(key) offer.allocate_code(code) offer.start() # Start receiving the key receive = WormholeReceive(code) msg_tuple = yield receive.start() downloaded_key_data, success, _ = msg_tuple assert_true(success) log.info("Checking with key: %r", downloaded_key_data) assert_equal(downloaded_key_data, file_key_data)