Commits

danjac  committed 7a3d126

assert401 added

  • Participants
  • Parent commits 6f6da35

Comments (0)

Files changed (2)

File flaskext/testing.py

         self.assertStatus(response, 200)
 
     assert_200 = assert200
+    
+    def assert401(self, response):
+        """
+        Checks if response status code is 401
+
+        :versionadded: 0.2.1
+        :param response: Flask response
+        """
+
+        self.assertStatus(response, 401)
+
+    assert_401 = assert401
 
     def assert403(self, response):
         """

File tests/__init__.py

     @app.route("/forbidden/")
     def forbidden():
         abort(403)
+    
+    @app.route("/unauthorized/")
+    def unauthorized():
+        abort(401)
+
 
     return app
 
 
         response = self.client.get("/forbidden/")
         self.assert403(response)
+    
+    def test_assert_401(self):
+
+        response = self.client.get("/unauthorized/")
+        self.assert401(response)
+
 
     def test_assert_405(self):