from nose.tools import assert_equal
+from mediagoblin import mg_globals
from mediagoblin.auth import lib as auth_lib
+from mediagoblin.db.sql.models import User
from mediagoblin.tests.tools import setup_fresh_app, fixture_add_user
-from mediagoblin import mg_globals
from mediagoblin.tools import template, mail
u'Invalid email address.']
## At this point there should be no users in the database ;)
- assert not mg_globals.database.User.find().count()
+ assert not User.query.count()
# Successful register
# -------------------
import os
import tempfile
-from nose.tools import assert_raises
+from nose.tools import assert_raises, assert_equal, assert_true
from werkzeug.utils import secure_filename
from mediagoblin import storage
'garbage_arg': 'garbage_arg',
'storage_class':
'mediagoblin.tests.test_storage:FakeStorageSystem'})
- assert this_storage.foobie == 'eiboof'
- assert this_storage.blech == 'hcelb'
- assert this_storage.__class__ is FakeStorageSystem
+ assert_equal(this_storage.foobie, 'eiboof')
+ assert_equal(this_storage.blech, 'hcelb')
+ assert_equal(unicode(this_storage.__class__),
+ u'mediagoblin.tests.test_storage.FakeStorageSystem')
##########################
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from mediagoblin.tests.tools import get_test_app
-
from mediagoblin import mg_globals
+from mediagoblin.tests.tools import get_test_app
+from mediagoblin.db.sql.models import User
def test_get_test_app_wipes_db():
Make sure we get a fresh database on every wipe :)
"""
get_test_app()
- assert mg_globals.database.User.find().count() == 0
+ assert User.query.count() == 0
new_user = mg_globals.database.User()
new_user.username = u'lolcat'
new_user.email = u'lol@cats.example.org'
new_user.pw_hash = u'pretend_this_is_a_hash'
new_user.save()
- assert mg_globals.database.User.find().count() == 1
+ assert User.query.count() == 1
get_test_app()
- assert mg_globals.database.User.find().count() == 0
+ assert User.query.count() == 0