Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
08c8628
Upgrade factory-boy to 2.11.1
twidi Jun 11, 2018
d637a48
Upgrade django-filter to 1.1.0
twidi Jun 11, 2018
962e08f
Upgrade Django to last 1.10 version: 1.10.8
twidi Jun 11, 2018
90d9d83
Upgrade Django to last 1.11 version: 1.11.13
twidi Jun 11, 2018
9d7ed6e
Upgrade djangorestframework to last 3.6 version: 3.6.4
twidi Jun 11, 2018
c897a1f
Upgrade django-rest-swagger to 2.2.0
twidi Jun 11, 2018
e725100
Upgrade Markdown to 2.6.11
twidi Jun 11, 2018
2529d39
Upgrade pycaption to 1.0.1
twidi Jun 11, 2018
f0014fb
Upgrade Pillow to 5.1.0
twidi Jun 11, 2018
5ab011f
Upgrade boto3 to 1.7.35
twidi Jun 11, 2018
8f0f9c1
Upgrade celery to last 3 version: 3.1.25
twidi Jun 11, 2018
cb04a81
Upgrade django-celery to 3.2.2
twidi Jun 11, 2018
2c9c57c
Upgrade djangoresetframework to last 3.7 version: 3.77
twidi Jun 11, 2018
ba74458
Upgrade djangoresetframework to 3.8.2
twidi Jun 11, 2018
c319e2a
Add on_delete arg to FK/O2O fields
twidi Jun 11, 2018
408122b
Add app_name included urls
twidi Jun 11, 2018
4c34725
Replace django.core.urlresolvers by from django.urls import reverse
twidi Jun 11, 2018
6bbfcd1
Resolve django-filter deprecation
twidi Jun 11, 2018
bc6ea72
Use @action instead of @detail_route for DRF function views
twidi Jun 11, 2018
a2927c4
Use new middleware system from django 1.10
twidi Jun 11, 2018
720733c
Upgrade Django to 2.0.6
twidi Jun 11, 2018
4404c8a
Support only 3.6+
twidi Jun 14, 2018
3214a44
`mock` is available from `unittest` in python 3
twidi Jun 14, 2018
fe0be1e
Apply isort & black
twidi Jun 14, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
language: python
python:
- "3.4"
- "3.5"
- "3.6"
sudo: required
dist: trusty
before_install:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Videofront [![Build Status](https://travis-ci.org/openfun/videofront.svg?branch=master)](https://travis-ci.org/openfun/videofront)

A scalable video hosting platform written in Django.
A scalable video hosting platform written in Django 2, for Python 3.6.

Initially, Videofront was developed to host videos of MOOCs taught on [Open edX](https://open.edx.org/) platforms, but it can easily be used in just any web platform that requires video embedding.

Expand Down Expand Up @@ -106,7 +106,7 @@ Pick a backend and customize the settings file accordingly:

The recommended approach is to start gunicorn and celery workers with `supervisorctl`:

$ cat /etc/supervisor/conf.d/videofront.conf
$ cat /etc/supervisor/conf.d/videofront.conf
[group:videofront]
programs=gunicorn,celery,celery-beat

Expand Down Expand Up @@ -141,7 +141,7 @@ The recommended approach is to start gunicorn and celery workers with `superviso

Recommended nginx configuration:

$ cat /etc/nginx/sites-enabled/videofront.vhost
$ cat /etc/nginx/sites-enabled/videofront.vhost
upstream django {
server 127.0.0.1:8000;
}
Expand All @@ -156,7 +156,7 @@ Recommended nginx configuration:
# This depends on the STATIC_ROOT setting
alias /home/user/videofront/static/;
}

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
Expand Down
2 changes: 1 addition & 1 deletion api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class ApiConfig(AppConfig):
name = 'api'
name = "api"
1 change: 1 addition & 0 deletions api/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver

from rest_framework.authtoken.models import Token


Expand Down
4 changes: 2 additions & 2 deletions api/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.contrib.auth.models import User
from django.test import TestCase

from rest_framework.authtoken.models import Token


class ApiV1ModelsTests(TestCase):

def test_tokens_are_created_for_all_users(self):
user = User.objects.create(username='testuser')
user = User.objects.create(username="testuser")
self.assertEqual(1, Token.objects.filter(user=user).count())
3 changes: 1 addition & 2 deletions api/tests/v1/base.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django.test import TestCase
from django.contrib.auth.models import User
from django.test import TestCase


class BaseAuthenticatedTests(TestCase):

def setUp(self):
self.user = User.objects.create(username="test", is_active=True)
self.user.set_password("password")
Expand Down
60 changes: 39 additions & 21 deletions api/tests/v1/test_playlists.py
Original file line number Diff line number Diff line change
@@ -1,77 +1,95 @@
from django.core.urlresolvers import reverse
from django.urls import reverse

from pipeline.tests import factories

from .base import BaseAuthenticatedTests


class PlaylistTests(BaseAuthenticatedTests):

def test_list_playlists_no_result(self):
response = self.client.get(reverse('api:v1:playlist-list'))
response = self.client.get(reverse("api:v1:playlist-list"))
playlists = response.json()
self.assertEqual([], playlists)

def test_get_playlist(self):
playlist = factories.PlaylistFactory(name="Funkadelic playlist", owner=self.user)
response = self.client.get(reverse('api:v1:playlist-detail', kwargs={'id': playlist.public_id}))
playlist = factories.PlaylistFactory(
name="Funkadelic playlist", owner=self.user
)
response = self.client.get(
reverse("api:v1:playlist-detail", kwargs={"id": playlist.public_id})
)
result = response.json()

self.assertEqual(200, response.status_code)
self.assertEqual("Funkadelic playlist", result["name"])
self.assertEqual(playlist.public_id, result["id"])

def test_search_playlist_by_name(self):
factories.PlaylistFactory(name="Funkadelic", owner=self.user, public_id="funkid")
factories.PlaylistFactory(name="Rockabilly", owner=self.user, public_id="rockid")
factories.PlaylistFactory(
name="Funkadelic", owner=self.user, public_id="funkid"
)
factories.PlaylistFactory(
name="Rockabilly", owner=self.user, public_id="rockid"
)

response_funk = self.client.get(reverse('api:v1:playlist-list'), data={'name': 'Funk'})
response_funk = self.client.get(
reverse("api:v1:playlist-list"), data={"name": "Funk"}
)
playlists_funk = response_funk.json()

self.assertEqual(1, len(playlists_funk))
self.assertEqual('funkid', playlists_funk[0]['id'])
self.assertEqual("funkid", playlists_funk[0]["id"])

def test_insert_video_in_playlist(self):
playlist = factories.PlaylistFactory(name="Funkadelic playlist", owner=self.user)
playlist = factories.PlaylistFactory(
name="Funkadelic playlist", owner=self.user
)
factories.VideoFactory(public_id="videoid", owner=self.user)

response = self.client.post(
reverse("api:v1:playlist-add-video", kwargs={'id': playlist.public_id}),
data={"id": 'videoid'}
reverse("api:v1:playlist-add-video", kwargs={"id": playlist.public_id}),
data={"id": "videoid"},
)

self.assertEqual(204, response.status_code)
self.assertEqual(1, playlist.videos.count())

def test_insert_non_existing_video_in_playlist(self):
playlist = factories.PlaylistFactory(name="Funkadelic playlist", owner=self.user)
playlist = factories.PlaylistFactory(
name="Funkadelic playlist", owner=self.user
)

response = self.client.post(
reverse("api:v1:playlist-add-video", kwargs={'id': playlist.public_id}),
data={"id": 'videoid'}
reverse("api:v1:playlist-add-video", kwargs={"id": playlist.public_id}),
data={"id": "videoid"},
)

self.assertEqual(404, response.status_code)

def test_insert_video_from_different_user_in_playlist(self):
playlist = factories.PlaylistFactory(name="Funkadelic playlist", owner=self.user)
playlist = factories.PlaylistFactory(
name="Funkadelic playlist", owner=self.user
)
different_user = factories.UserFactory()
factories.VideoFactory(public_id="videoid", owner=different_user)

response = self.client.post(
reverse("api:v1:playlist-add-video", kwargs={'id': playlist.public_id}),
data={"id": 'videoid'}
reverse("api:v1:playlist-add-video", kwargs={"id": playlist.public_id}),
data={"id": "videoid"},
)

self.assertEqual(404, response.status_code)

def test_remove_video_from_playlist(self):
playlist = factories.PlaylistFactory(name="Funkadelic playlist", owner=self.user)
playlist = factories.PlaylistFactory(
name="Funkadelic playlist", owner=self.user
)
video = factories.VideoFactory(public_id="videoid", owner=self.user)
playlist.videos.add(video)

response = self.client.post(
reverse("api:v1:playlist-remove-video", kwargs={'id': playlist.public_id}),
data={"id": 'videoid'}
reverse("api:v1:playlist-remove-video", kwargs={"id": playlist.public_id}),
data={"id": "videoid"},
)

self.assertEqual(204, response.status_code)
Loading