Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some typos (with crate-ci/typos + manual assistance) #25

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions src/libpvarki/middleware/mtlsheader.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""FastAPI auth middleware for mTLS proxy-hearer auth"""
"""FastAPI auth middleware for mTLS proxy-header auth"""
from typing import Optional, Mapping
import logging

Expand All @@ -14,7 +14,7 @@


class MTLSHeader(HTTPBase): # pylint: disable=R0903
"""Check NGinx injected mTLS header"""
"""Check Nginx injected mTLS header"""

def __init__(
self,
Expand Down
4 changes: 2 additions & 2 deletions src/libpvarki/mtlshelp/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_ca_context(
purpose: ssl.Purpose,
extra_ca_certs_path: Optional[Path] = None,
) -> ssl.SSLContext:
"""Get SSL/TLS context with our local CA certs"""
"""Get SSL/TLS context with our local CA certs"""
LOGGER.debug("ssl.create_default_context(purpose={})".format(purpose))
ssl_ctx = ssl.create_default_context(purpose=purpose)
if not extra_ca_certs_path:
Expand All @@ -36,7 +36,7 @@ def get_ssl_context(
client_cert_paths: Optional[Tuple[Path, Path]] = None,
extra_ca_certs_path: Optional[Path] = None,
) -> ssl.SSLContext:
"""Get SSL/TLS context with our local CA certs and client auth,
"""Get SSL/TLS context with our local CA certs and client auth,
if the cert paths are not set ENV or defaults will be used

You can use this to create a server context too, put server cert and key to client paths"""
Expand Down
2 changes: 1 addition & 1 deletion tests/middleware/test_middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@pytest.fixture
def mtlsclient() -> Generator[TestClient, None, None]:
"""Fake the NGinx header"""
"""Fake the Nginx header"""
client = TestClient(
APP,
headers={
Expand Down
12 changes: 6 additions & 6 deletions tests/mtls/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ async def keypair(nice_tmpdir: str) -> AsyncGenerator[Tuple[KPTYPE, Path, Path],
yield ckp, privpath, pubpath


def check_csr(pemdata: str, expct_cn: str) -> None:
def check_csr(pemdata: str, expect_cn: str) -> None:
"""Check the CSR"""
assert pemdata.startswith("-----BEGIN CERTIFICATE REQUEST-----\nMII")
parsed = cryptography.x509.load_pem_x509_csr(pemdata.encode("utf-8"))
dname = parsed.subject.rfc4514_string()
LOGGER.debug("dname: {}".format(dname))
assert f"CN={expct_cn}" in dname
assert f"CN={expect_cn}" in dname


@pytest.mark.asyncio
Expand All @@ -101,7 +101,7 @@ async def test_create_client_csr_async(keypair: Tuple[KPTYPE, Path, Path]) -> No
ckp, _privpath, pubpath = keypair
csrpath = pubpath.parent / "myname.csr"
pemdata = await async_create_client_csr(ckp, csrpath, {"CN": "ROTTA03b"})
check_csr(pemdata, expct_cn="ROTTA03b")
check_csr(pemdata, expect_cn="ROTTA03b")


@pytest.mark.asyncio
Expand All @@ -110,7 +110,7 @@ async def test_create_client_csr_sync(keypair: Tuple[KPTYPE, Path, Path]) -> Non
ckp, _privpath, pubpath = keypair
csrpath = pubpath.parent / "myname.csr"
pemdata = create_client_csr(ckp, csrpath, {"CN": "ROTTA03b"})
check_csr(pemdata, expct_cn="ROTTA03b")
check_csr(pemdata, expect_cn="ROTTA03b")


@pytest.mark.asyncio
Expand All @@ -119,7 +119,7 @@ async def test_create_server_csr_async(keypair: Tuple[KPTYPE, Path, Path]) -> No
ckp, _privpath, pubpath = keypair
csrpath = pubpath.parent / "myname.csr"
pemdata = await async_create_server_csr(ckp, csrpath, ["localmaeher.pvarki.fi", "IP:127.0.0.1"])
check_csr(pemdata, expct_cn="localmaeher.pvarki.fi")
check_csr(pemdata, expect_cn="localmaeher.pvarki.fi")


@pytest.mark.asyncio
Expand All @@ -128,4 +128,4 @@ async def test_create_sever_csr_sync(keypair: Tuple[KPTYPE, Path, Path]) -> None
ckp, _privpath, pubpath = keypair
csrpath = pubpath.parent / "myname.csr"
pemdata = create_server_csr(ckp, csrpath, ["localmaeher.pvarki.fi", "IP:127.0.0.1"])
check_csr(pemdata, expct_cn="localmaeher.pvarki.fi")
check_csr(pemdata, expect_cn="localmaeher.pvarki.fi")
6 changes: 3 additions & 3 deletions tests/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ async def test_false() -> None:

@pytest.mark.asyncio
async def test_stdout() -> None:
"""Test that echo exists with code 0 and ouputs what we expect to stdout"""
"""Test that echo exists with code 0 and outputs what we expect to stdout"""
code, stdout, stderr = await call_cmd("echo 'hello world'")
assert code == 0
assert stdout == "hello world\n"
Expand All @@ -38,7 +38,7 @@ async def test_stdout() -> None:

@pytest.mark.asyncio
async def test_stderr() -> None:
"""Test that echo exists with code 0 and ouputs what we expect to stderr"""
"""Test that echo exists with code 0 and outputs what we expect to stderr"""
code, stdout, stderr = await call_cmd("echo 'goodbye world' >&2")
# FIXME: Capture log output and check for the warning
assert code == 0
Expand All @@ -48,7 +48,7 @@ async def test_stderr() -> None:

@pytest.mark.asyncio
async def test_stderr_nowarn() -> None:
"""Test that echo exists with code 0 and ouputs what we expect to stderr"""
"""Test that echo exists with code 0 and outputs what we expect to stderr"""
code, stdout, stderr = await call_cmd("echo 'goodbye world' >&2", stderr_warn=False)
# FIXME: Capture log output and check that there is no warning
assert code == 0
Expand Down
Loading