예제 #1
0
파일: account_tests.py 프로젝트: jav/aicomp
    def testDeleteAccount(self):
        acc = Account(user="******", passwd="passwd", email="email")
        acc.save()
        acc = Account.fetch(user="******")
        assert acc.user == "user"

        acc.delete()
        acc = Account.fetch(user="******")
        assert acc is None
예제 #2
0
파일: account_tests.py 프로젝트: jav/aicomp
    def testCreateAccount(self):
        self.assertRaises(TypeError, Account, user="******")
        self.assertRaises(TypeError, Account, passwd="passwd")
        acc = Account(user="******", passwd="passwd", email="email")
        acc.save()

        print "Acc made:", acc
        acc = Account.fetch(user="******")
        assert acc is None
        acc = Account.fetch(user="******")
        assert acc.user == "user"
        acc = Account.fetch(email="bar")
        assert acc is None
        acc = Account.fetch(email="email")
        assert acc.email == "email"
예제 #3
0
파일: account_tests.py 프로젝트: jav/aicomp
    def testFetchAccount(self):
        # Hey, this test is redundant(!) with the previous, but I can't
        # decide what to test where, is this coupeled enough to
        # merge?

        acc = Account(user="******", passwd="passwd", email="email")
        acc.save()

        acc = Account.fetch(user="******")
        assert acc is None
        acc = Account.fetch(user="******")
        assert acc.user == "user"
        acc = Account.fetch(email="bar")
        assert acc is None
        acc = Account.fetch(email="email")
        assert acc.email == "email"
예제 #4
0
파일: account_tests.py 프로젝트: jav/aicomp
    def testModifyAccount(self):
        # You'r allowed to change passwd & e-mail
        # But not your username!
        acc = Account(user="******", passwd="passwd", email="email")
        acc.save()
        acc = Account.fetch(user="******")
        assert acc.user == "user"

        acc.user = "******"
        self.assertRaises(TypeError, acc.save)

        acc = Account.fetch(user="******")
        assert acc.user == "user"
        assert acc.passwd == "passwd"
        assert acc.email == "email"
        acc.passwd = "newpass"
        acc.email = "newmail"
        acc.save()

        acc = None
        acc = Account.fetch(user="******")
        assert acc.user == "user"
        assert acc.passwd == "newpass"
        assert acc.email == "newmail"