-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.http
153 lines (113 loc) · 3.35 KB
/
tests.http
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# A collection of test for Project 9 in the Full Stack JavaScript Techdegree
# Tests for the User Routes section of the rubric
### Get User (With Auth)
GET http://localhost:5000/api/users HTTP/1.1
Authorization: Basic [email protected]:joepassword
### Create User
POST http://localhost:5000/api/users HTTP/1.1
Authorization: Basic [email protected]:joepassword
Content-Type: application/json
{
"firstName": "John",
"lastName": "Smith",
"emailAddress": "[email protected]",
"password": "password"
}
### Create User (Existing Email) - EXCEEDS
POST http://localhost:5000/api/users HTTP/1.1
Authorization: Basic [email protected]:joepassword
Content-Type: application/json
{
"firstName": "Joe",
"lastName": "Smith",
"emailAddress": "[email protected]",
"password": "password"
}
# Tests for the Course Routes section of the rubric
### Get Courses
GET http://localhost:5000/api/courses HTTP/1.1
### Get Course
GET http://localhost:5000/api/courses/1 HTTP/1.1
### Create Course (Minimum Data)
POST http://localhost:5000/api/courses HTTP/1.1
Authorization: Basic [email protected]:joepassword
Content-Type: application/json
{
"title": "My new course",
"description": "This is the course I created",
"userId": 1
}
### Update Course (Minimum Data)
PUT http://localhost:5000/api/courses/1 HTTP/1.1
Authorization: Basic [email protected]:joepassword
Content-Type: application/json
{
"id": 1,
"title": "Updated course!",
"description": "The course description has been updated as well.",
"userId": 1
}
### Delete Course (With Auth)
DELETE http://localhost:5000/api/courses/4 HTTP/1.1
Authorization: Basic [email protected]:joepassword
### Update Course (Not Owner) - EXCEEDS
PUT http://localhost:5000/api/courses/3 HTTP/1.1
Authorization: Basic [email protected]:joepassword
Content-Type: application/json
{
"id": 3,
"title": "Updated course!",
"description": "The course description has been updated as well.",
"userId": 1
}
### Delete Course (Not Owner) - EXCEEDS
DELETE http://localhost:5000/api/courses/3 HTTP/1.1
Authorization: Basic [email protected]:joepassword
# Tests for the Validations section of the rubric
### Create User (Incomplete Data)
POST http://localhost:5000/api/users HTTP/1.1
Authorization: Basic [email protected]:joepassword
Content-Type: application/json
{
}
### Create Course (Incomplete Data)
POST http://localhost:5000/api/courses HTTP/1.1
Authorization: Basic [email protected]:joepassword
Content-Type: application/json
{
}
### Update Course (Incomplete Data)
PUT http://localhost:5000/api/courses/1 HTTP/1.1
Authorization: Basic [email protected]:joepassword
Content-Type: application/json
{
"title": "",
"description": ""
}
### Create User (Invalid Email) - EXCEEDS
POST http://localhost:5000/api/users HTTP/1.1
Authorization: Basic [email protected]:joepassword
Content-Type: application/json
{
"firstName": "Sam",
"lastName": "Smith",
"emailAddress": "sam.com",
"password": "password"
}
# Tests for the Permissions section of the rubric
### Get User (No Auth)
GET http://localhost:5000/api/users HTTP/1.1
### Create Course (No Auth, Incomplete Data)
POST http://localhost:5000/api/courses HTTP/1.1
Content-Type: application/json
{
}
### Update Course (No Auth, Incomplete Data)
PUT http://localhost:5000/api/courses/1 HTTP/1.1
Content-Type: application/json
{
"title": "",
"description": ""
}
### Delete Course (No Auth)
DELETE http://localhost:5000/api/courses/1 HTTP/1.1