Commits

Andriy Kornatskyy committed a0a1941

Added benchmark tests for signin/signup validation in order to stress test form parsing.

Comments (0)

Files changed (1)

demos/template/src/membership/web/tests/benchmark_views.py

 from wheezy.core.benchmark import Benchmark
 
 from membership.web.tests.test_views import MembershipTestCase
+from membership.web.tests.test_views import SignInTestCase
+from membership.web.tests.test_views import SignUpTestCase
 
 
 class BenchmarkTestCase(MembershipTestCase):  # pragma: nocover
 
     def runTest(self):
-        """ Perform bachmark and print results.
+        """ Perform benchmark and print results.
         """
         p = Benchmark((
             self.test_signin,
                 'test_signup': 0.89,
                 'test_signout': 4.32,
         })
+
+
+class BenchmarkSigninTestCase(SignInTestCase):
+
+    def runTest(self):
+        """ Perform benchmark and print results.
+        """
+        p = Benchmark((
+            self.test_validation_error,
+            self.test_unknown_user,
+            self.test_xrsf_token_invalid
+            ), 200)
+
+        p.report('signin', baselines={
+                'test_validation_error': 1.0,
+                'test_unknown_user': 1.0,
+                'test_xrsf_token_invalid': 0.94
+        })
+
+
+class BenchmarkSignupTestCase(SignUpTestCase):
+
+    def runTest(self):
+        """ Perform benchmark and print results.
+        """
+        p = Benchmark((
+            self.test_validation_error,
+            self.test_already_registered,
+            self.test_resubmission_token_invalid,
+            ), 100)
+
+        p.report('signup', baselines={
+                'test_validation_error': 1.0,
+                'test_already_registered': 1.0,
+                'test_resubmission_token_invalid': 1.05
+        })