Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove runtime function, add tests, README updates, improved previous…
…/next buttons
- Loading branch information
Showing
12 changed files
with
121 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import pytest | ||
from newsic import create_app | ||
|
||
@pytest.fixture() | ||
def app(): | ||
app = create_app() | ||
with app.app_context(): | ||
app.config.from_object('newsic.config.Local') | ||
app.config['TESTING'] = True | ||
yield app | ||
|
||
@pytest.fixture() | ||
def client(app): | ||
return app.test_client() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import pytest | ||
|
||
@pytest.mark.parametrize("route, expected", [ | ||
("/youtube/PLdduFHK2eLvfGM7ADIbCgWHFRvu1yBNj0/", "Now, Now - MJ"), | ||
("/vimeo/album/3951181/", "Rollercoaster Girl") | ||
]) | ||
def test_routes(client, route, expected): | ||
response = client.get(route) | ||
assert expected.encode('ascii') in response.data | ||
|
||
|
||
@pytest.mark.parametrize("route, expected", [ | ||
("/youtube/invalid-playlist/test/", "URL not found"), | ||
("/youtube/invalid-playlist/", "This playlist is either empty, private or non-existing"), | ||
("/vimeo/channel/invalid-channel/", "This album/channel is either empty, private or non-existing") | ||
]) | ||
def test_routes_i18n_en(client, route, expected, app): | ||
with app.app_context(): | ||
app.config['BABEL_DEFAULT_LOCALE'] = 'en' | ||
response = client.get(route) | ||
assert expected.encode('ascii') in response.data | ||
|
||
|
||
@pytest.mark.parametrize("route, expected", [ | ||
("/youtube/invalid-playlist/test/", "URL nicht gefunden"), | ||
("/youtube/invalid-playlist/", "Diese Playlist ist entweder leer, privat oder existiert nicht"), | ||
("/vimeo/channel/invalid-channel/", "Dieses Album bzw. dieser Channel ist entweder leer, privat oder existiert nicht") | ||
]) | ||
def test_routes_i18n_de(client, route, expected, app): | ||
with app.app_context(): | ||
app.config['BABEL_DEFAULT_LOCALE'] = 'de' | ||
response = client.get(route) | ||
assert expected.encode('ascii') in response.data |