Esempio n. 1
0
    def test_find(self):
        email1 = "*****@*****.**"
        email2 = "*****@*****.**"

        assert User.find("test0")["alias"] == "test0"
        assert User.find(email1)["email"] == email1
        assert_raises(KeyError, User.find, email2)
Esempio n. 2
0
    def test_chkpasswd(self):
        # new hash
        test0 = User.find("test0")
        assert test0.chkpasswd("testtest")
        assert not test0.chkpasswd("deadf00d")

        # KBS hash
        test2 = User.find("test2")
        assert test2.chkpasswd("woshiruomima")
        assert not test2.chkpasswd("th1s-1z_mUCh>S7r0nG3r")
Esempio n. 3
0
    def test_chkpasswd(self):
        # new hash
        test0 = User.find_by_alias('test0')
        assert test0.chkpasswd('testtest')
        assert not test0.chkpasswd('deadf00d')

        # KBS hash
        test2 = User.find_by_alias('test2')
        assert test2.chkpasswd('woshiruomima')
        assert not test2.chkpasswd('th1s-1z_mUCh>S7r0nG3r')
Esempio n. 4
0
 def test_find_by_guess(self):
     assert User.find_by_guess('1030512202')['alias'] == 'test2'
     assert User.find_by_guess('叫我曹尼玛')['alias'] == 'test2'
     assert User.find_by_guess('test0')['ident'] == '1030513101'
Esempio n. 5
0
    def test_find_by_display_name(self):
        nd1, nd2 = '-灰 煮 牛-', 'test2'

        assert User.find_by_display_name(nd1)['ident'] == '1030513101'
        assert User.find_by_display_name(nd2) is None
Esempio n. 6
0
    def test_find_by_alias(self):
        alias1, alias2 = 'test0', 'nonexistent'

        assert User.find_by_alias(alias1)['ident'] == '1030513101'
        assert User.find_by_alias(alias2) is None
Esempio n. 7
0
    def test_find_by_ident(self):
        number1, number2 = '1030512202', '0123456789'

        assert User.find_by_ident(number1)['alias'] == 'test2'
        assert User.find_by_ident(number2) is None