1111import app .routers .customer as customer
1212from app .model .customer import Customer
1313
14+ CUSTOMERS_ENDPOINT = "/context/customers"
15+
1416
1517@pytest .fixture
1618def reload_customer_router () -> None :
@@ -22,17 +24,17 @@ def test_customers_insert_read_delete(
2224 test_client : TestClient ,
2325 reload_customer_router : None ,
2426):
25- initial_delete_response : Response = test_client .delete ("/context/customers" )
27+ initial_delete_response : Response = test_client .delete (CUSTOMERS_ENDPOINT )
2628 assert_that (initial_delete_response .status_code ).is_equal_to (204 )
2729
2830 customer1 = Customer (first_name = "fname1" , last_name = "lname1" )
2931 customer2 = Customer (first_name = "fname2" , last_name = "lname2" )
3032 input_json = jsonable_encoder ([customer1 , customer2 ])
3133
32- create_response : Response = test_client .put ("/context/customers" , json = input_json )
34+ create_response : Response = test_client .put (CUSTOMERS_ENDPOINT , json = input_json )
3335 assert_that (create_response .status_code ).is_equal_to (204 )
3436
35- read_response : Response = test_client .get ("/context/customers" )
37+ read_response : Response = test_client .get (CUSTOMERS_ENDPOINT )
3638
3739 assert_that (read_response .status_code ).is_equal_to (200 )
3840 response_json : list [dict [str , Any ]] = read_response .json ()
@@ -41,10 +43,10 @@ def test_customers_insert_read_delete(
4143 assert_that (response_json ).contains (jsonable_encoder (customer1 ))
4244 assert_that (response_json ).contains (jsonable_encoder (customer2 ))
4345
44- delete_response : Response = test_client .delete ("/context/customers" )
46+ delete_response : Response = test_client .delete (CUSTOMERS_ENDPOINT )
4547 assert_that (delete_response .status_code ).is_equal_to (204 )
4648
47- read_response_after_delete : Response = test_client .get ("/context/customers" )
49+ read_response_after_delete : Response = test_client .get (CUSTOMERS_ENDPOINT )
4850
4951 assert_that (read_response_after_delete .status_code ).is_equal_to (200 )
5052 response_json_after_delete : list [dict [str , Any ]] = read_response_after_delete .json ()
0 commit comments