def test_create_tables(self): """Test that model.create_tables correctly creates all database tables.""" self.assertRaises(OperationalError, User.by_user_name, u'test') create_tables() assert _create_test_user() create_tables() assert User.by_user_name(u'creosote') create_tables(drop_all=True) try: user = User.by_user_name(u'creosote') except SQLObjectNotFound: user = None assert user is None
def test_create_default_user(self): "Test that the default user is created correctly" create_tables() create_default_user(u'creosote', u'secret') retrieved_user = User.by_email_address(u'*****@*****.**' % u'creosote') assert retrieved_user assert retrieved_user.user_name == u'creosote' assert retrieved_user.display_name == u'Default User' assert retrieved_user.password
def test_user_creation(self): """Object creation should set the name.""" obj = _create_test_user() retrieved_user = User.by_email_address(u'*****@*****.**') assert retrieved_user, \ 'User should have been found by email address' assert retrieved_user.user_name == u'creosote', \ "User name should have been creosote, not '%s'" % retrieved_user.user_name assert obj.display_name == u"Mr Creosote"