File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 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):
3535
3636 return response
3737
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+
3853 def test_get_sample_text_content (self ):
3954 """
4055 A call to /sample.txt returns the correct body
@@ -173,6 +188,17 @@ def test_root_index(self):
173188 for path in os .listdir (local_path ):
174189 self .assertIn (path , body , error_comment )
175190
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 )
176202
177203
178204if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments