Esempio n. 1
0
 def test_pwhash(self):
     pw, salt = MudAccounts._pwhash("secret")
     pw2, salt2 = MudAccounts._pwhash("secret")
     self.assertNotEqual(pw, pw2)
     self.assertNotEqual(salt, salt2)
     pw, salt = MudAccounts._pwhash("secret", "some salt")
     pw2, salt2 = MudAccounts._pwhash("secret", "some salt")
     self.assertEqual(pw, pw2)
     self.assertEqual(salt, salt2)
Esempio n. 2
0
 def test_pwhash(self):
     pw, salt = MudAccounts._pwhash("secret")
     pw2, salt2 = MudAccounts._pwhash("secret")
     self.assertNotEqual(pw, pw2)
     self.assertNotEqual(salt, salt2)
     pw, salt = MudAccounts._pwhash("secret", "some salt")
     pw2, salt2 = MudAccounts._pwhash("secret", "some salt")
     self.assertEqual(pw, pw2)
     self.assertEqual(salt, salt2)
Esempio n. 3
0
 def test_accept_password(self):
     pw = "hello3"
     self.assertEqual(pw, MudAccounts.accept_password(pw))
     pw = "hello this is a long pass pharse 12345"
     self.assertEqual(pw, MudAccounts.accept_password(pw))
     pw = "he44zzz"
     self.assertEqual(pw, MudAccounts.accept_password(pw))
     pw = "   test  2  "
     self.assertEqual(pw, MudAccounts.accept_password(pw))
     with self.assertRaises(ValueError):
         MudAccounts.accept_password("")
     with self.assertRaises(ValueError):
         MudAccounts.accept_password("shrt2")
     with self.assertRaises(ValueError):
         MudAccounts.accept_password("no digits")
     with self.assertRaises(ValueError):
         MudAccounts.accept_password("223242455")
Esempio n. 4
0
 def test_accept_email(self):
     self.assertEqual("x@y", MudAccounts.accept_email("x@y"))
     self.assertEqual("*****@*****.**", MudAccounts.accept_email("*****@*****.**"))
     with self.assertRaises(ValueError):
         MudAccounts.accept_email("@")
     with self.assertRaises(ValueError):
         MudAccounts.accept_email("test@")
     with self.assertRaises(ValueError):
         MudAccounts.accept_email("@test.com")
     with self.assertRaises(ValueError):
         MudAccounts.accept_email(" x@y")
     with self.assertRaises(ValueError):
         MudAccounts.accept_email("x@y ")
Esempio n. 5
0
 def test_accept_name(self):
     self.assertEqual("irm", MudAccounts.accept_name("irm"))
     self.assertEqual("irmendejongyeahz", MudAccounts.accept_name("irmendejongyeahz"))
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("irmendejongyeahxy")   # too long
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("aa")   # too short
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("Irmen")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("irmen de jong")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("irmen_de_jong")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("irmen444")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name(" irmen")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("irmen ")
Esempio n. 6
0
 def test_accept_password(self):
     pw = "hello3"
     self.assertEqual(pw, MudAccounts.accept_password(pw))
     pw = "hello this is a long pass pharse 12345"
     self.assertEqual(pw, MudAccounts.accept_password(pw))
     pw = "he44zzz"
     self.assertEqual(pw, MudAccounts.accept_password(pw))
     pw = "   test  2  "
     self.assertEqual(pw, MudAccounts.accept_password(pw))
     with self.assertRaises(ValueError):
         MudAccounts.accept_password("")
     with self.assertRaises(ValueError):
         MudAccounts.accept_password("shrt2")
     with self.assertRaises(ValueError):
         MudAccounts.accept_password("no digits")
     with self.assertRaises(ValueError):
         MudAccounts.accept_password("223242455")
Esempio n. 7
0
 def test_accept_email(self):
     self.assertEqual("x@y", MudAccounts.accept_email("x@y"))
     self.assertEqual("*****@*****.**",
                      MudAccounts.accept_email("*****@*****.**"))
     with self.assertRaises(ValueError):
         MudAccounts.accept_email("@")
     with self.assertRaises(ValueError):
         MudAccounts.accept_email("test@")
     with self.assertRaises(ValueError):
         MudAccounts.accept_email("@test.com")
     with self.assertRaises(ValueError):
         MudAccounts.accept_email(" x@y")
     with self.assertRaises(ValueError):
         MudAccounts.accept_email("x@y ")
Esempio n. 8
0
 def test_accept_name(self):
     self.assertEqual("irm", MudAccounts.accept_name("irm"))
     self.assertEqual("irmendejongyeahz",
                      MudAccounts.accept_name("irmendejongyeahz"))
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("irmendejongyeahxy")  # too long
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("aa")  # too short
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("Irmen")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("irmen de jong")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("irmen_de_jong")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("irmen444")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name(" irmen")
     with self.assertRaises(ValueError):
         MudAccounts.accept_name("irmen ")