|
1 | 1 | import logging
|
2 |
| -import os |
3 | 2 | import ssl
|
4 | 3 | import subprocess
|
5 | 4 | import sys
|
|
32 | 31 | from sanic.worker.loader import CertLoader
|
33 | 32 |
|
34 | 33 |
|
35 |
| -current_dir = os.path.dirname(os.path.realpath(__file__)) |
36 |
| -localhost_dir = os.path.join(current_dir, "certs/localhost") |
37 |
| -password_dir = os.path.join(current_dir, "certs/password") |
38 |
| -sanic_dir = os.path.join(current_dir, "certs/sanic.example") |
39 |
| -invalid_dir = os.path.join(current_dir, "certs/invalid.nonexist") |
40 |
| -localhost_cert = os.path.join(localhost_dir, "fullchain.pem") |
41 |
| -localhost_key = os.path.join(localhost_dir, "privkey.pem") |
42 |
| -sanic_cert = os.path.join(sanic_dir, "fullchain.pem") |
43 |
| -sanic_key = os.path.join(sanic_dir, "privkey.pem") |
| 34 | +current_dir = Path(__file__).parent.resolve() |
| 35 | +localhost_dir = current_dir / "certs/localhost" |
| 36 | +password_dir = current_dir / "certs/password" |
| 37 | +sanic_dir = current_dir / "certs/sanic.example" |
| 38 | +invalid_dir = current_dir / "certs/invalid.nonexist" |
| 39 | +localhost_cert = localhost_dir / "fullchain.pem" |
| 40 | +localhost_key = localhost_dir / "privkey.pem" |
| 41 | +sanic_cert = sanic_dir / "fullchain.pem" |
| 42 | +sanic_key = sanic_dir / "privkey.pem" |
44 | 43 | password_dict = {
|
45 |
| - "cert": os.path.join(password_dir, "fullchain.pem"), |
46 |
| - "key": os.path.join(password_dir, "privkey.pem"), |
| 44 | + "cert": password_dir / "fullchain.pem", |
| 45 | + "key": password_dir / "privkey.pem", |
47 | 46 | "password": "password",
|
48 | 47 | "names": ["localhost"],
|
49 | 48 | }
|
@@ -383,7 +382,7 @@ async def handler(request):
|
383 | 382 | app.test_client.get("/test", server_kwargs={"ssl": ssl_list})
|
384 | 383 |
|
385 | 384 | assert "folder expected" in str(excinfo.value)
|
386 |
| - assert sanic_cert in str(excinfo.value) |
| 385 | + assert str(sanic_cert) in str(excinfo.value) |
387 | 386 |
|
388 | 387 |
|
389 | 388 | def test_missing_cert_path(app):
|
|
0 commit comments