Merge branch 'master' of git.sv.gnu.org:/srv/git/mediagoblin
This commit is contained in:
commit
157ee14b14
@ -69,6 +69,14 @@ The file-extension-based approach is used before the sniffing-based approach,
|
|||||||
if the file-extension-based approach finds a match, the sniffing-based approach
|
if the file-extension-based approach finds a match, the sniffing-based approach
|
||||||
will be skipped as it uses far more processing power.
|
will be skipped as it uses far more processing power.
|
||||||
|
|
||||||
|
Configuring Media Types
|
||||||
|
=======================
|
||||||
|
|
||||||
|
Each media type has a ``config_spec.ini`` file with configurable
|
||||||
|
options and comments explaining their intended side effect. For
|
||||||
|
instance the ``video`` media type configuration can be found in
|
||||||
|
``mediagoblin/media_types/video/config_spec.ini``.
|
||||||
|
|
||||||
|
|
||||||
Video
|
Video
|
||||||
=====
|
=====
|
||||||
|
@ -587,7 +587,12 @@ def feed_endpoint(request, outbox=None):
|
|||||||
outbox = outbox.limit(limit)
|
outbox = outbox.limit(limit)
|
||||||
|
|
||||||
# Offset (default: no offset - first <count> result)
|
# Offset (default: no offset - first <count> result)
|
||||||
outbox = outbox.offset(request.args.get("offset", 0))
|
offset = request.args.get("offset", 0)
|
||||||
|
try:
|
||||||
|
offset = int(offset)
|
||||||
|
except ValueError:
|
||||||
|
offset = 0
|
||||||
|
outbox = outbox.offset(offset)
|
||||||
|
|
||||||
# Build feed.
|
# Build feed.
|
||||||
for activity in outbox:
|
for activity in outbox:
|
||||||
|
@ -438,8 +438,8 @@ class TestAPI(object):
|
|||||||
|
|
||||||
def test_read_feed(self, test_app):
|
def test_read_feed(self, test_app):
|
||||||
""" Test able to read objects from the feed """
|
""" Test able to read objects from the feed """
|
||||||
response, data = self._upload_image(test_app, GOOD_JPG)
|
response, image_data = self._upload_image(test_app, GOOD_JPG)
|
||||||
response, data = self._post_image_to_feed(test_app, data)
|
response, data = self._post_image_to_feed(test_app, image_data)
|
||||||
|
|
||||||
uri = "/api/user/{0}/feed".format(self.active_user.username)
|
uri = "/api/user/{0}/feed".format(self.active_user.username)
|
||||||
with self.mock_oauth():
|
with self.mock_oauth():
|
||||||
@ -462,6 +462,48 @@ class TestAPI(object):
|
|||||||
assert feed["items"][0]["object"]["objectType"] == "image"
|
assert feed["items"][0]["object"]["objectType"] == "image"
|
||||||
assert feed["items"][0]["object"]["id"] == data["object"]["id"]
|
assert feed["items"][0]["object"]["id"] == data["object"]["id"]
|
||||||
|
|
||||||
|
default_limit = 20
|
||||||
|
items_count = default_limit * 2
|
||||||
|
for i in range(items_count):
|
||||||
|
response, image_data = self._upload_image(test_app, GOOD_JPG)
|
||||||
|
self._post_image_to_feed(test_app, image_data)
|
||||||
|
items_count += 1 # because there already is one
|
||||||
|
|
||||||
|
#
|
||||||
|
# default returns default_limit items
|
||||||
|
#
|
||||||
|
with self.mock_oauth():
|
||||||
|
response = test_app.get(uri)
|
||||||
|
feed = json.loads(response.body.decode())
|
||||||
|
assert len(feed["items"]) == default_limit
|
||||||
|
|
||||||
|
#
|
||||||
|
# silentely ignore count and offset that that are
|
||||||
|
# not a number
|
||||||
|
#
|
||||||
|
with self.mock_oauth():
|
||||||
|
response = test_app.get(uri + "?count=BAD&offset=WORSE")
|
||||||
|
feed = json.loads(response.body.decode())
|
||||||
|
assert len(feed["items"]) == default_limit
|
||||||
|
|
||||||
|
#
|
||||||
|
# if offset is less than default_limit items
|
||||||
|
# from the end of the feed, return less than
|
||||||
|
# default_limit
|
||||||
|
#
|
||||||
|
with self.mock_oauth():
|
||||||
|
near_the_end = items_count - default_limit / 2
|
||||||
|
response = test_app.get(uri + "?offset=%d" % near_the_end)
|
||||||
|
feed = json.loads(response.body.decode())
|
||||||
|
assert len(feed["items"]) < default_limit
|
||||||
|
|
||||||
|
#
|
||||||
|
# count=5 returns 5 items
|
||||||
|
#
|
||||||
|
with self.mock_oauth():
|
||||||
|
response = test_app.get(uri + "?count=5")
|
||||||
|
feed = json.loads(response.body.decode())
|
||||||
|
assert len(feed["items"]) == 5
|
||||||
|
|
||||||
def test_read_another_feed(self, test_app):
|
def test_read_another_feed(self, test_app):
|
||||||
""" Test able to read objects from someone else's feed """
|
""" Test able to read objects from someone else's feed """
|
||||||
|
@ -52,6 +52,21 @@ FORM_CONTEXT = ['mediagoblin/submit/start.html', 'submit_form']
|
|||||||
REQUEST_CONTEXT = ['mediagoblin/user_pages/user.html', 'request']
|
REQUEST_CONTEXT = ['mediagoblin/user_pages/user.html', 'request']
|
||||||
|
|
||||||
|
|
||||||
|
SKIP_AUDIO = False
|
||||||
|
SKIP_VIDEO = False
|
||||||
|
|
||||||
|
try:
|
||||||
|
import gi.repository.Gst
|
||||||
|
except ImportError:
|
||||||
|
SKIP_AUDIO = True
|
||||||
|
SKIP_VIDEO = True
|
||||||
|
|
||||||
|
try:
|
||||||
|
import scikits.audiolab
|
||||||
|
except ImportError:
|
||||||
|
SKIP_AUDIO = True
|
||||||
|
|
||||||
|
|
||||||
class TestSubmission:
|
class TestSubmission:
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def setup(self, test_app):
|
def setup(self, test_app):
|
||||||
@ -389,14 +404,20 @@ class TestSubmission:
|
|||||||
media = self.check_media(None, {"title": u"With GPS data"}, 1)
|
media = self.check_media(None, {"title": u"With GPS data"}, 1)
|
||||||
assert media.get_location.position["latitude"] == 59.336666666666666
|
assert media.get_location.position["latitude"] == 59.336666666666666
|
||||||
|
|
||||||
|
@pytest.mark.skipif(SKIP_AUDIO,
|
||||||
|
reason="Dependencies for audio not met")
|
||||||
def test_audio(self):
|
def test_audio(self):
|
||||||
with create_av(make_audio=True) as path:
|
with create_av(make_audio=True) as path:
|
||||||
self.check_normal_upload('Audio', path)
|
self.check_normal_upload('Audio', path)
|
||||||
|
|
||||||
|
@pytest.mark.skipif(SKIP_VIDEO,
|
||||||
|
reason="Dependencies for video not met")
|
||||||
def test_video(self):
|
def test_video(self):
|
||||||
with create_av(make_video=True) as path:
|
with create_av(make_video=True) as path:
|
||||||
self.check_normal_upload('Video', path)
|
self.check_normal_upload('Video', path)
|
||||||
|
|
||||||
|
@pytest.mark.skipif(SKIP_AUDIO or SKIP_VIDEO,
|
||||||
|
reason="Dependencies for audio or video not met")
|
||||||
def test_audio_and_video(self):
|
def test_audio_and_video(self):
|
||||||
with create_av(make_audio=True, make_video=True) as path:
|
with create_av(make_audio=True, make_video=True) as path:
|
||||||
self.check_normal_upload('Audio and Video', path)
|
self.check_normal_upload('Audio and Video', path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user