source: HTTP_SMOKE_TEST.http

Last change on this file was 2e0035f, checked in by Acko <lavurovski.a65@…>, 8 days ago

Initial Commit

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[2e0035f]1### Nutritioneer - click the green arrows in IntelliJ, top to bottom.
2### The token from step 2 is captured into a variable and reused.
3
4@host = http://localhost:8080
5
6### 1. Register a fresh account (409 if you run it twice - that is correct)
7POST {{host}}/api/auth/register
8Content-Type: application/json
9
10{ "email": "test.user@example.com", "username": "test_user", "password": "testPass@1" }
11
12### 2. Log in as a seeded account
13# @name login
14POST {{host}}/api/auth/login
15Content-Type: application/json
16
17{ "email": "marija.trajkovska@gmail.com", "password": "testPass@1" }
18
19> {% client.global.set("token", response.body.token); %}
20
21### 3. The public feed
22GET {{host}}/api/posts/feed
23Authorization: Bearer {{token}}
24
25### 4. UC1001 - create a recipe. No kcal is sent; the server derives it.
26# @name newRecipe
27POST {{host}}/api/recipes
28Authorization: Bearer {{token}}
29Content-Type: application/json
30
31{
32 "name": "Test Bean Stew",
33 "guide": "1. Boil the beans.\n2. Fry the onion.\n3. Combine and bake.",
34 "servings": 4,
35 "ingredients": [
36 { "ingredientName": "Dry white beans", "quantity": 400 },
37 { "ingredientName": "Onion", "quantity": 150 },
38 { "ingredientName": "Olive oil", "quantity": 30 }
39 ],
40 "restrictionIds": []
41}
42
43> {% client.global.set("recipeId", response.body.id); %}
44
45### 5. UC1004 - share it. Running this twice returns 409 (uq_post_recipe).
46POST {{host}}/api/posts
47Authorization: Bearer {{token}}
48Content-Type: application/json
49
50{ "recipeId": {{recipeId}}, "isPrivate": false, "isFavourite": false, "status": "published" }
51
52### 6. UC1002 - log a meal (attach post id 1 from the seed data)
53POST {{host}}/api/planner
54Authorization: Bearer {{token}}
55Content-Type: application/json
56
57{ "notes": "Smoke test lunch", "postIds": [1], "consumed": true }
58
59### 7. Daily totals
60GET {{host}}/api/planner/daily?from=2026-01-20&to=2026-02-05
61Authorization: Bearer {{token}}
62
63### 8. UC1003 - grocery list from a recipe plus one item
64POST {{host}}/api/grocery-lists
65Authorization: Bearer {{token}}
66Content-Type: application/json
67
68{
69 "notes": "Smoke test list",
70 "bulkRecipeIds": [1],
71 "singleItems": [{ "ingredientName": "Apple", "buyQuantity": 1000 }]
72}
73
74### 9. Biometrics
75POST {{host}}/api/biometrics
76Authorization: Bearer {{token}}
77Content-Type: application/json
78
79{ "date": "2026-02-02", "weight": 72.0, "height": 168, "age": 29, "muscleFatRatio": 1.97 }
80
81### 10. Should be 403 - a regular user is not an administrator
82GET {{host}}/api/admin/accounts
83Authorization: Bearer {{token}}
84
85### 11. Log in as the trainer
86# @name trainerLogin
87POST {{host}}/api/auth/login
88Content-Type: application/json
89
90{ "email": "viktor.ilievski@nutritioneer.mk", "password": "testPass@1" }
91
92> {% client.global.set("trainerToken", response.body.token); %}
93
94### 12. UC3001 - client weekly intake
95GET {{host}}/api/trainer/clients/marija.trajkovska@gmail.com/intake?from=2026-01-22&to=2026-01-29
96Authorization: Bearer {{trainerToken}}
97
98### 13. UC3004 - protein density ranking
99GET {{host}}/api/trainer/analysis/nutrient-density?nutrient=Protein&limit=5
100Authorization: Bearer {{trainerToken}}
101
102### 14. UC3003 - feed filtered by restriction
103GET {{host}}/api/posts/feed/by-restriction?type=gluten_free&avoid=Contains tree nuts
104Authorization: Bearer {{trainerToken}}
Note: See TracBrowser for help on using the repository browser.