class TestAPI(object):
def setUp(self):
- self.app = get_test_app()
+ self.app = get_test_app(dump_old_app=False)
self.db = mg_globals.database
self.user_password = u'4cc355_70k3N'
class TestHTTPCallback(object):
def setUp(self):
- self.app = get_test_app()
+ self.app = get_test_app(dump_old_app=False)
self.db = mg_globals.database
self.user_password = u'secret'
class TestSubmission:
def setUp(self):
- self.test_app = get_test_app()
+ self.test_app = get_test_app(dump_old_app=False)
# TODO: Possibly abstract into a decorator like:
# @as_authenticated_user('chris')
def test_tags(self):
# Good tag string
# --------
- response, request = self.do_post({'title': u'Balanced Goblin',
+ response, request = self.do_post({'title': u'Balanced Goblin 2',
'tags': GOOD_TAG_STRING},
*REQUEST_CONTEXT, do_follow=True,
**self.upload_data(GOOD_JPG))
- media = self.check_media(request, {'title': u'Balanced Goblin'}, 1)
+ media = self.check_media(request, {'title': u'Balanced Goblin 2'}, 1)
assert media.tags[0]['name'] == u'yin'
assert media.tags[0]['slug'] == u'yin'
# Test tags that are too long
# ---------------
- response, form = self.do_post({'title': u'Balanced Goblin',
+ response, form = self.do_post({'title': u'Balanced Goblin 2',
'tags': BAD_TAG_STRING},
*FORM_CONTEXT,
**self.upload_data(GOOD_JPG))
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from mediagoblin import mg_globals
-from mediagoblin.tests.tools import get_test_app
+from mediagoblin.tests.tools import get_test_app, fixture_add_user
from mediagoblin.db.models import User
"""
Make sure we get a fresh database on every wipe :)
"""
- get_test_app()
+ get_test_app(dump_old_app=True)
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()
+ fixture_add_user()
assert User.query.count() == 1
- get_test_app()
+ get_test_app(dump_old_app=False)
+ assert User.query.count() == 1
+ get_test_app(dump_old_app=True)
assert User.query.count() == 0