-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from edx/ned/upgrade-django-18
Upgrade to Django 1.8
- Loading branch information
Showing
13 changed files
with
82 additions
and
64 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
sudo: false | ||
|
||
language: python | ||
|
||
python: | ||
- "2.7" | ||
|
||
branches: | ||
only: | ||
- master | ||
cache: | ||
directories: | ||
- $HOME/.cache/pip | ||
|
||
before_install: | ||
- "export DISPLAY=:99" | ||
- "sh -e /etc/init.d/xvfb start" | ||
|
||
install: | ||
- "make install" | ||
- "pip install coveralls" | ||
|
||
script: | ||
- "make quality" | ||
- "make cover" | ||
|
||
after_success: | ||
- "coveralls" |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
cookiecutter==0.9.0 | ||
Django >= 1.4, < 1.5 | ||
Django>=1.8,<1.9 | ||
lxml | ||
requests | ||
webob | ||
|
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
coverage | ||
ddt | ||
mock | ||
pylint==0.28 | ||
pep8 | ||
rednose | ||
bok_choy==0.3.3 | ||
bok_choy==0.4.3 | ||
|
||
# Acid xblock | ||
-e git+https://github.com/edx/acid-block.git@e46f9cda8a03e121a00c7e347084d142d22ebfb7#egg=acid-xblock |
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
{% load url from future %} | ||
|
||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
|
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{% load staticfiles %} | ||
{% load url from future %} | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
|
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 |
---|---|---|
@@ -1,60 +1,68 @@ | ||
"""Test that all scenarios render successfully.""" | ||
|
||
import lxml.html | ||
import unittest | ||
|
||
import ddt | ||
from django.test.client import Client | ||
import lxml.html | ||
from django.core.urlresolvers import reverse | ||
|
||
from xblock.test.tools import assert_equals | ||
|
||
from workbench import scenarios | ||
from workbench.runtime import reset_global_state | ||
|
||
|
||
@ddt.ddt | ||
class ScenarioTest(unittest.TestCase): | ||
"""Test the scenario support.""" | ||
def setUp(self): | ||
super(ScenarioTest, self).setUp() | ||
reset_global_state() | ||
|
||
def test_all_scenarios(self): | ||
"""Load the home page, examine the scenarios displayed.""" | ||
client = Client() | ||
response = client.get("/") | ||
assert response.status_code == 200 | ||
html = lxml.html.fromstring(response.content) | ||
a_tags = list(html.xpath('//a')) | ||
|
||
# Load the loaded_scenarios from the classes. | ||
loaded_scenarios = scenarios.SCENARIOS.values() | ||
|
||
# We should have an <a> tag for each scenario. | ||
assert_equals(len(a_tags), len(loaded_scenarios)) | ||
|
||
# We should have at least one scenario with a vertical tag, since we use | ||
# empty verticals as our canary in the coal mine that something has gone | ||
# horribly wrong with loading the loaded_scenarios. | ||
assert any("<vertical_demo>" in scen.xml for scen in loaded_scenarios) | ||
|
||
# Since we are claiming in try_scenario that no vertical is empty, let's | ||
# eliminate the possibility that a scenario has an actual empty vertical. | ||
assert all("<vertical_demo></vertical_demo>" not in scen.xml for scen in loaded_scenarios) | ||
assert all("<vertical_demo/>" not in scen.xml for scen in loaded_scenarios) | ||
|
||
@ddt.data(*scenarios.SCENARIOS.keys()) | ||
def test_scenario(self, scenario_id): | ||
"""A very shallow test, just to see if the scenario loads all its blocks. | ||
We don't know enough about each scenario to know what each should do. | ||
So we load the scenario to see that the workbench could successfully | ||
serve it. | ||
""" | ||
url = reverse('workbench_show_scenario', kwargs={'scenario_id': scenario_id}) | ||
client = Client() | ||
response = client.get(url, follow=True) | ||
assert response.status_code == 200, scenario_id | ||
|
||
def test_all_scenarios(): | ||
"""Load the home page, get every URL, make a test from it.""" | ||
client = Client() | ||
response = client.get("/") | ||
assert response.status_code == 200 | ||
html = lxml.html.fromstring(response.content) | ||
a_tags = list(html.xpath('//a')) | ||
for a_tag in a_tags: | ||
yield try_scenario, a_tag.get('href'), a_tag.text | ||
|
||
# Load the loaded_scenarios from the classes. | ||
loaded_scenarios = scenarios.SCENARIOS.values() | ||
|
||
# We should have an <a> tag for each scenario. | ||
assert_equals(len(a_tags), len(loaded_scenarios)) | ||
|
||
# We should have at least one scenario with a vertical tag, since we use | ||
# empty verticals as our canary in the coal mine that something has gone | ||
# horribly wrong with loading the loaded_scenarios. | ||
assert any("<vertical_demo>" in scen.xml for scen in loaded_scenarios) | ||
|
||
# Since we are claiming in try_scenario that no vertical is empty, let's | ||
# eliminate the possibility that a scenario has an actual empty vertical. | ||
assert all("<vertical_demo></vertical_demo>" not in scen.xml for scen in loaded_scenarios) | ||
assert all("<vertical_demo/>" not in scen.xml for scen in loaded_scenarios) | ||
|
||
|
||
def try_scenario(url, name): | ||
"""Check that a scenario renders without error. | ||
`url`: the URL to the scenario to test. | ||
`name`: the name of the scenario, used in error messages. | ||
""" | ||
# This is a very shallow test. We don't know enough about each scenario to | ||
# know what each should do. So we load the scenario to see that the | ||
# workbench could successfully serve it. | ||
client = Client() | ||
response = client.get(url, follow=True) | ||
assert response.status_code == 200, name | ||
|
||
# Be sure we got the whole scenario. Again, we can't know what to expect | ||
# here, but at the very least, if there are verticals, they should not be | ||
# empty. That would be a sign that some data wasn't loaded properly while | ||
# rendering the scenario. | ||
html = lxml.html.fromstring(response.content) | ||
for vertical_tag in html.xpath('//div[@class="vertical"]'): | ||
# No vertical tag should be empty. | ||
assert list(vertical_tag), "Empty <vertical> shouldn't happen!" | ||
# Be sure we got the whole scenario. Again, we can't know what to expect | ||
# here, but at the very least, if there are verticals, they should not be | ||
# empty. That would be a sign that some data wasn't loaded properly while | ||
# rendering the scenario. | ||
html = lxml.html.fromstring(response.content) | ||
for vertical_tag in html.xpath('//div[@class="vertical"]'): | ||
# No vertical tag should be empty. | ||
assert list(vertical_tag), "Empty <vertical> shouldn't happen!" |
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