Skip to content

Commit 6eab5eb

Browse files
updated routes for test
1 parent f3cd03f commit 6eab5eb

File tree

4 files changed

+11
-14
lines changed

4 files changed

+11
-14
lines changed

tests/conftest.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def test_user(client):
4848
"password" : "password123"
4949
}
5050

51-
res = client.post("/users/", json=user_data)
51+
res = client.post("/api/users/", json=user_data)
5252

5353
assert res.status_code == 201
5454

@@ -114,7 +114,6 @@ def test_sales(session, test_products):
114114
sales_data = [
115115
{
116116
"state": "Wisconsin",
117-
# "description": "this is the sale number 1",
118117
"value" : 100.44,
119118
"fee" : 60.24,
120119
"currency" : "us dollar",
@@ -123,7 +122,6 @@ def test_sales(session, test_products):
123122
},
124123
{
125124
"state": "Florida",
126-
# "description": "this is the sale number 2",
127125
"value" : 90.12,
128126
"fee" : 69.99,
129127
"currency" : "us dollar",
@@ -132,7 +130,6 @@ def test_sales(session, test_products):
132130
},
133131
{
134132
"state": "Florida",
135-
# "description": "this is the sale number 3",
136133
"value" : 290.44,
137134
"fee" : 10.24,
138135
"currency" : "us dollar",

tests/test_products.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66

77
def test_get_one_product(client, test_products):
8-
res = client.get(f"/products/{test_products[0].id}")
8+
res = client.get(f"/api/products/{test_products[0].id}")
99
product = schemas.Product(**res.json())
1010

1111
assert product.id == test_products[0].id
1212
assert res.status_code == 200
1313

1414
def test_get_all_products(client, test_products):
15-
res = client.get("/products/")
15+
res = client.get("/api/products/")
1616

1717
def validate(product):
1818
return schemas.ProductBase(**product)
@@ -26,7 +26,7 @@ def validate(product):
2626

2727
def test_create_product(authorized_client):
2828
res = authorized_client.post(
29-
"/products/", json={
29+
"/api/products/", json={
3030
"name" : "Product0",
3131
"description" : "this is the description",
3232
"price" : 25.44,
@@ -38,7 +38,7 @@ def test_create_product(authorized_client):
3838

3939
def test_unauthorized_create_product(client):
4040
res = client.post(
41-
"/products/", json={
41+
"/api/products/", json={
4242
"name" : "Product0",
4343
"description" : "this is the description",
4444
"price" : 25.44,

tests/test_sales.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
import src.schemas as schemas
44

55
def test_get_one_sale(client, test_sales):
6-
res = client.get(f"/sales/{test_sales[0].id}")
6+
res = client.get(f"/api/sales/{test_sales[0].id}")
77
sale = schemas.Sale(**res.json())
88

99
assert sale.id == test_sales[0].id
1010
assert res.status_code == 200
1111

1212

1313
def test_get_all_sales(client, test_sales):
14-
res = client.get("/sales/")
14+
res = client.get("/api/sales/")
1515

1616
def validate(sale):
1717
return schemas.SaleBase(**sale)
@@ -25,7 +25,7 @@ def validate(sale):
2525

2626
def test_create_sale(authorized_client, test_products):
2727
res = authorized_client.post(
28-
"/sales/", json={
28+
"/api/sales/", json={
2929
"state": "Florida",
3030
"value" : 100.44,
3131
"fee" : 60.24,
@@ -38,7 +38,7 @@ def test_create_sale(authorized_client, test_products):
3838

3939
def test_unauthorized_create_sale(client, test_products):
4040
res = client.post(
41-
"/sales/", json={
41+
"/api/sales/", json={
4242
"state": "Florida",
4343
"description": "state is updated",
4444
"value" : 100.44,

tests/test_users.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from tests.conftest import test_user
66

77
def test_create_user(client):
8-
res = client.post("/users/", json={
8+
res = client.post("api/users/", json={
99
"username" : "Testy",
1010
"email" : "[email protected]",
1111
"password" : "password123"
@@ -16,7 +16,7 @@ def test_create_user(client):
1616
assert res.status_code == 201
1717

1818
def test_login_user(client, test_user):
19-
res = client.post("/login", data={
19+
res = client.post("/api/auth/login", data={
2020
"username" : test_user['email'],
2121
"password" : test_user['password']
2222
})

0 commit comments

Comments
 (0)