示例#1
0
 def test_createDelete(self):
     testusername = "******" % (randint(100, 999))
     newuser = User.create(testusername, "xxx")
     self.assertIsNotNone(newuser)
     self.assertTrue(User.exists(testusername))
     newuser.delete()
     self.assertFalse(User.exists(testusername))
示例#2
0
def main():

    if db.exists() is True:
        p = db.path()
        print ""
        print "Database already exists: %s" % (p)
        print ""
        exit(1)

    print ""
    print "Creating database..."
    db.create()
    print ""
    username = "******"
    password = ''.join(random.choice(string.lowercase) for i in range(8))
    newuser = User.create(username, password)
    print "New user '%s' created with password '%s'" % (username, password)

    return
示例#3
0
 def createTestUser(self):
     if User.exists(self.username) is False:
         newuser = User.create(self.username, self.password)