File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,21 @@ def get_response(self, url):
35
35
36
36
return response
37
37
38
+ def test_post_yields_method_not_allowed (self ):
39
+ """
40
+ Sending a POST request should yield a 405 Method Not Allowed response
41
+ """
42
+
43
+ conn = http .client .HTTPConnection ('localhost:10000' )
44
+ conn .request ('POST' , '/' )
45
+
46
+ response = conn .getresponse ()
47
+
48
+ conn .close ()
49
+
50
+ self .assertEqual (response .getcode (), 405 )
51
+
52
+
38
53
def test_get_sample_text_content (self ):
39
54
"""
40
55
A call to /sample.txt returns the correct body
@@ -173,6 +188,17 @@ def test_root_index(self):
173
188
for path in os .listdir (local_path ):
174
189
self .assertIn (path , body , error_comment )
175
190
191
+ def test_ok_response_at_root_index (self ):
192
+ """
193
+ A call to / at least yields a 200 OK response
194
+ """
195
+
196
+ directory = ''
197
+ web_path = '/' + directory
198
+
199
+ response = self .get_response (web_path )
200
+
201
+ self .assertEqual (response .getcode (), 200 )
176
202
177
203
178
204
if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments