Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ unit-test = [
]
int-test = [
"linode_api4[test-shared]",
"cryptography",
]
lint = [
"black>=23.1.0",
Expand Down
32 changes: 22 additions & 10 deletions test/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import logging
import os
import random
import subprocess
import time
from test.integration.helpers import (
get_test_label,
Expand All @@ -14,6 +13,8 @@

import pytest
import requests
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import ed25519
from requests.exceptions import ConnectionError, RequestException

from linode_api4 import (
Expand Down Expand Up @@ -263,17 +264,28 @@ def create_linode_for_pass_reset(test_linode_client, e2e_test_firewall):


@pytest.fixture(scope="session")
def ssh_key_gen(tmp_path_factory):
key_path = tmp_path_factory.mktemp("ssh-key-gen") / "sdk-sshkey"

subprocess.run(
["ssh-keygen", "-q", "-t", "rsa", "-f", str(key_path), "-N", ""],
check=True,
def ssh_key_gen():
key = ed25519.Ed25519PrivateKey.generate()

pub_key = (
key.public_key()
.public_bytes(
encoding=serialization.Encoding.OpenSSH,
format=serialization.PublicFormat.OpenSSH,
)
.decode()
.rstrip()
)
priv_key = (
key.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.OpenSSH,
encryption_algorithm=serialization.NoEncryption(),
)
.decode()
.rstrip()
)

pub_key = key_path.with_suffix(".pub").read_text().rstrip()
priv_key = key_path.read_text().rstrip()

yield pub_key, priv_key


Expand Down
Loading