예제 #1
0
 def testOTPReuse(self):
   """Verify that reusing an OTP yields no cookie."""
   otp._ClearUserHistory()
   self._SendJSONRequest('test-user', 'test-password', otp.GetOTP('test-user'), 200, True)
   self.wait()
   self._SendJSONRequest('test-user', 'test-password', otp.GetOTP('test-user'), 200, False)
   self.wait()
예제 #2
0
 def _GetAdminOpener(self):
     """Gets the admin opener. Returns the opener and api_host."""
     otp._ClearUserHistory()
     api_host = 'www.goviewfinder.com:%d' % self.get_http_port()
     tmp_file = tempfile.NamedTemporaryFile(delete=False)
     opener = otp.GetAdminOpener(api_host, 'test-user', 'test-password',
                                 otp.GetOTP('test-user'), tmp_file.name)
     return api_host, opener
예제 #3
0
 def _GetAdminOpener(self):
   """Gets the admin opener. Returns the opener and api_host."""
   otp._ClearUserHistory()
   api_host = 'www.goviewfinder.com:%d' % self.get_http_port()
   tmp_file = tempfile.NamedTemporaryFile(delete=False)
   opener = otp.GetAdminOpener(api_host, 'test-user', 'test-password',
                               otp.GetOTP('test-user'), tmp_file.name)
   return api_host, opener
예제 #4
0
 def testHTTPAdminAuthenticate(self):
   """Authenticate test-user admin via HTTP with a form post."""
   otp._ClearUserHistory()
   self._SendHTTPRequest('test-user', 'test-password', otp.GetOTP('test-user'), 302, True)
   self.wait()
   otp._ClearUserHistory()
   self._SendHTTPRequest('test-user', 'wrong-password', otp.GetOTP('test-user'), 200, False)
   self.wait()
예제 #5
0
 def testOTPReuse(self):
     """Verify that reusing an OTP yields no cookie."""
     otp._ClearUserHistory()
     self._SendJSONRequest('test-user', 'test-password',
                           otp.GetOTP('test-user'), 200, True)
     self.wait()
     self._SendJSONRequest('test-user', 'test-password',
                           otp.GetOTP('test-user'), 200, False)
     self.wait()
예제 #6
0
 def testHTTPAdminAuthenticate(self):
     """Authenticate test-user admin via HTTP with a form post."""
     otp._ClearUserHistory()
     self._SendHTTPRequest('test-user', 'test-password',
                           otp.GetOTP('test-user'), 302, True)
     self.wait()
     otp._ClearUserHistory()
     self._SendHTTPRequest('test-user', 'wrong-password',
                           otp.GetOTP('test-user'), 200, False)
     self.wait()
예제 #7
0
 def testBadUser(self):
     """Verify bad user yields no cookie."""
     otp._ClearUserHistory()
     self._SendJSONRequest('wrong-user', 'test-password',
                           otp.GetOTP('test-user'), 200, False)
     self.wait()
예제 #8
0
 def testBadOTP(self):
     """Verify that incorrect OTP value yields no cookie."""
     otp._ClearUserHistory()
     self._SendJSONRequest('test-user', 'test-password', 0, 200, False)
     self.wait()
예제 #9
0
 def testJSONAdminAuthenticate(self):
     """Authenticate test-user admin via JSON."""
     otp._ClearUserHistory()
     self._SendJSONRequest('test-user', 'test-password',
                           otp.GetOTP('test-user'), 200, True)
     self.wait()
예제 #10
0
 def testBadUser(self):
   """Verify bad user yields no cookie."""
   otp._ClearUserHistory()
   self._SendJSONRequest('wrong-user', 'test-password', otp.GetOTP('test-user'), 200, False)
   self.wait()
예제 #11
0
 def testBadOTP(self):
   """Verify that incorrect OTP value yields no cookie."""
   otp._ClearUserHistory()
   self._SendJSONRequest('test-user', 'test-password', 0, 200, False)
   self.wait()
예제 #12
0
 def testJSONAdminAuthenticate(self):
   """Authenticate test-user admin via JSON."""
   otp._ClearUserHistory()
   self._SendJSONRequest('test-user', 'test-password', otp.GetOTP('test-user'), 200, True)
   self.wait()