示例#1
0
    def testGetUserByName(self):

        '''
        getUserByName() should retrieve a user with a given name and return
        False if there is no user with the name.
        '''

        # False with no user.
        self.assertFalse(User.getUserByName('user'))

        user = User('user', 'password', False)
        db.session.add(user)
        db.session.commit()

        # When user exists, returns record.
        userRecord = User.getUserByName('user')
        self.assertEquals(user.id, userRecord.id)