Пример #1
0
 def test_register_duplicate(self):
     """ If registering duplicate user, registration returns 400 """
     ret = login.register(self.request, 'dsa', 'pass')
     self.assertEqual(ret.status_code, 400)
Пример #2
0
 def test_register(self):
     """ Registering new user registers user with access backend """
     self.request.access.user_data.return_value = None
     login.register(self.request, 'dsa', 'pass')
     # pylint: disable=E1101
     self.request.access.register.assert_called_with('dsa', 'pass')
Пример #3
0
 def test_register_disabled(self):
     """ If registration is disabled, registering new user returns 403 """
     self.request.access.allow_register.return_value = False
     ret = login.register(self.request, 'dsa', 'pass')
     self.assertEqual(ret.status_code, 403)
Пример #4
0
 def test_register_long_password(self):
     """ Super long passwords can't register """
     self.request.access.user_data.return_value = None
     ret = login.register(self.request, 'abc', 200 * 'a')
     self.assertEqual(ret['code'], 400)
Пример #5
0
 def test_register_duplicate(self):
     """ If registering duplicate user, registration returns 400 """
     ret = login.register(self.request, 'dsa', 'pass')
     self.assertEqual(ret['code'], 400)
     self.assertEqual(self.request.response.status_code, 400)
Пример #6
0
 def test_register_long_username(self):
     """ Super long usernames can't register """
     self.request.access.user_data.return_value = None
     ret = login.register(self.request, 200 * 'a', 'pass')
     self.assertEqual(ret['code'], 400)
Пример #7
0
 def test_register_blank_username(self):
     """ Blank usernames can't register """
     self.request.access.user_data.return_value = None
     ret = login.register(self.request, '', 'pass')
     self.assertEqual(ret['code'], 400)
Пример #8
0
 def test_register(self):
     """ Registering new user registers user with access backend """
     self.request.access.user_data.return_value = None
     login.register(self.request, 'dsa', 'pass')
     # pylint: disable=E1101
     self.request.access.register.assert_called_with('dsa', 'pass')
Пример #9
0
 def test_register_disabled(self):
     """ If registration is disabled, registering new user returns 403 """
     self.request.access.allow_register.return_value = False
     self.request.access.need_admin.return_value = False
     ret = login.register(self.request, 'dsa', 'pass')
     self.assertEqual(ret.status_code, 403)
Пример #10
0
 def test_register_duplicate(self):
     """ If registering duplicate user, registration returns 400 """
     ret = login.register(self.request, "dsa", "pass")
     self.assertEqual(ret["code"], 400)
     self.assertEqual(self.request.response.status_code, 400)
Пример #11
0
 def test_register_duplicate(self):
     """ If registering duplicate user, registration returns 400 """
     ret = login.register(self.request, "dsa", "pass")
     self.assertEqual(ret["code"], 400)
     self.assertEqual(self.request.response.status_code, 400)
Пример #12
0
 def test_register_long_password(self):
     """ Super long passwords can't register """
     self.request.access.user_data.return_value = None
     ret = login.register(self.request, "abc", 200 * "a")
     self.assertEqual(ret["code"], 400)
Пример #13
0
 def test_register_blank_username(self):
     """ Blank usernames can't register """
     self.request.access.user_data.return_value = None
     ret = login.register(self.request, "", "pass")
     self.assertEqual(ret["code"], 400)
Пример #14
0
 def test_register_long_username(self):
     """ Super long usernames can't register """
     self.request.access.user_data.return_value = None
     ret = login.register(self.request, 200 * "a", "pass")
     self.assertEqual(ret["code"], 400)