Clean all

This commit is contained in:
Fang-Pen Lin
2025-11-13 09:22:00 -08:00
parent 3742d23d60
commit 4b70f73362
3 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -10,7 +10,7 @@ from dotenv import load_dotenv
from faker import Faker from faker import Faker
import logging import logging
from features.steps.utils import clear_all_nock, restore_nock from features.steps.utils import clean_all_nock, restore_nock
load_dotenv() load_dotenv()
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -207,5 +207,5 @@ def before_all(context: Context):
def after_scenario(context: Context, scenario: typing.Any): def after_scenario(context: Context, scenario: typing.Any):
if hasattr(context, "web_server"): if hasattr(context, "web_server"):
context.web_server.shutdown_and_server_close() context.web_server.shutdown_and_server_close()
clear_all_nock(context) clean_all_nock(context)
restore_nock(context) restore_nock(context)
+3 -3
View File
@@ -281,10 +281,10 @@ def restore_nock(context: Context):
response.raise_for_status() response.raise_for_status()
def clear_all_nock(context: Context): def clean_all_nock(context: Context):
jwt_token = context.vars["AUTH_TOKEN"] jwt_token = context.vars["AUTH_TOKEN"]
response = context.http_client.post( response = context.http_client.post(
"/api/v1/bdd-nock/clear-all", "/api/v1/bdd-nock/clean-all",
headers=dict(authorization="Bearer {}".format(jwt_token)), headers=dict(authorization="Bearer {}".format(jwt_token)),
json=dict(), json=dict(),
) )
@@ -297,5 +297,5 @@ def with_nocks(context: Context, definitions: list[dict]):
define_nock(context, definitions) define_nock(context, definitions)
yield yield
finally: finally:
clear_all_nock(context) clean_all_nock(context)
restore_nock(context) restore_nock(context)
@@ -39,7 +39,7 @@ export const registerBddNockRouter = async (server: FastifyZodProvider) => {
server.route({ server.route({
method: "POST", method: "POST",
url: "/clear-all", url: "/clean-all",
schema: { schema: {
response: { response: {
200: z.object({ status: z.string() }) 200: z.object({ status: z.string() })