aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/tests/test_submission.py
diff options
context:
space:
mode:
authortom <tom@teamfay.co.uk>2015-12-12 11:29:27 +0000
committerChristopher Allan Webber <cwebber@dustycloud.org>2016-01-07 11:04:13 -0800
commit43cf0a68f2244e0c56cf2da0340363163bbaae53 (patch)
treec04fc38ccdf96a9dedd1cc81ccc0f025ee64e029 /mediagoblin/tests/test_submission.py
parent5f60a4550d4ae46fdea07bc5f11f8513bdac8f77 (diff)
downloadmediagoblin-43cf0a68f2244e0c56cf2da0340363163bbaae53.tar.lz
mediagoblin-43cf0a68f2244e0c56cf2da0340363163bbaae53.tar.xz
mediagoblin-43cf0a68f2244e0c56cf2da0340363163bbaae53.zip
Add test to check that an activity is created when a collection was chosen.
Diffstat (limited to 'mediagoblin/tests/test_submission.py')
-rw-r--r--mediagoblin/tests/test_submission.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/mediagoblin/tests/test_submission.py b/mediagoblin/tests/test_submission.py
index eed7afa3..0ec49ec7 100644
--- a/mediagoblin/tests/test_submission.py
+++ b/mediagoblin/tests/test_submission.py
@@ -36,7 +36,7 @@ Gst.init(None)
from mediagoblin.tests.tools import fixture_add_user, fixture_add_collection
from .media_tools import create_av
from mediagoblin import mg_globals
-from mediagoblin.db.models import MediaEntry, User, LocalUser
+from mediagoblin.db.models import MediaEntry, User, LocalUser, Activity
from mediagoblin.db.base import Session
from mediagoblin.tools import template
from mediagoblin.media_types.image import ImageMediaManager
@@ -426,14 +426,14 @@ class TestSubmission:
def test_collection_selection(self):
"""Test the ability to choose a collection when submitting media
"""
- # Collection option shouldn't be present if the user has no collections
+ # Collection option should have been removed if the user has no
+ # collections.
response = self.test_app.get('/submit/')
assert 'collection' not in response.form.fields
+ # Test upload of an image when a user has no collections.
upload = webtest.forms.Upload(os.path.join(
'mediagoblin', 'static', 'images', 'media_thumbs', 'image.png'))
-
- # Check that upload of an image when a user has no collections
response.form['file'] = upload
no_collection_title = 'no collection'
response.form['title'] = no_collection_title
@@ -466,6 +466,13 @@ class TestSubmission:
col = self.our_user().collections[0]
assert col.collection_items[0].get_object().title == title
+ # Test that an activity was created when the item was added to the
+ # collection. That should be the last activity.
+ assert Activity.query.order_by(
+ Activity.id.desc()
+ ).first().content == '{0} added new picture to {1}'.format(
+ self.our_user().username, col.title)
+
# Test upload succeeds if the user has collection and no collection is
# chosen.
form['file'] = webtest.forms.Upload(os.path.join(