diff --git a/.travis.yml b/.travis.yml index 130bf4b5..4437b826 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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" diff --git a/Makefile b/Makefile index edd588bd..5388cd4d 100755 --- a/Makefile +++ b/Makefile @@ -36,3 +36,10 @@ quality: cover: coverage run manage.py test coverage report + +clean: + rm -f workbench.log* workbench.test.* + rm -rf workbench/static/djpyfs + rm -rf *.egg-info + rm -f .coverage + find . -name '.git' -prune -o -name '*.pyc' -exec rm {} \; diff --git a/requirements/base.txt b/requirements/base.txt index 553daac8..a2bc1b6e 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,5 +1,5 @@ cookiecutter==0.9.0 -Django >= 1.4, < 1.5 +Django>=1.8,<1.9 lxml requests webob diff --git a/requirements/test.txt b/requirements/test.txt index 9f9592a5..63f22381 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -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 diff --git a/setup.py b/setup.py index b4fa75f8..3932a427 100644 --- a/setup.py +++ b/setup.py @@ -55,7 +55,7 @@ def load_requirements(*requirements_paths): setup( name='xblock-sdk', - version='0.1a0', + version='0.1.1', description='XBlock SDK', packages=[ 'sample_xblocks', diff --git a/workbench/scenarios.py b/workbench/scenarios.py index 4537b959..b02b6e95 100644 --- a/workbench/scenarios.py +++ b/workbench/scenarios.py @@ -74,3 +74,5 @@ def init_scenarios(): # Get all the XBlock classes, and add their scenarios. for class_name, cls in sorted(XBlock.load_classes(fail_silently=False)): add_class_scenarios(class_name, cls, fail_silently=False) + +init_scenarios() diff --git a/workbench/templates/workbench/block.html b/workbench/templates/workbench/block.html index d209cbff..0406e0d3 100644 --- a/workbench/templates/workbench/block.html +++ b/workbench/templates/workbench/block.html @@ -1,6 +1,5 @@ {% load staticfiles %} -{% load url from future %}
diff --git a/workbench/templates/workbench/index.html b/workbench/templates/workbench/index.html index 956a27d0..e128d216 100644 --- a/workbench/templates/workbench/index.html +++ b/workbench/templates/workbench/index.html @@ -1,5 +1,4 @@ {% load staticfiles %} -{% load url from future %} diff --git a/workbench/test/selenium_test.py b/workbench/test/selenium_test.py index ba0bb560..ad9246a8 100644 --- a/workbench/test/selenium_test.py +++ b/workbench/test/selenium_test.py @@ -1,6 +1,6 @@ """Helpers for Selenium tests.""" -from django.test import LiveServerTestCase +from django.contrib.staticfiles.testing import StaticLiveServerTestCase from bok_choy.web_app_test import WebAppTest from nose.plugins.attrib import attr @@ -9,7 +9,7 @@ @attr('selenium') -class SeleniumTest(WebAppTest, LiveServerTestCase): +class SeleniumTest(WebAppTest, StaticLiveServerTestCase): """Base test class that provides setUpClass and tearDownClass methods necessary for selenium testing.""" diff --git a/workbench/test/test_scenarios.py b/workbench/test/test_scenarios.py index 71e33088..38d71d8c 100644 --- a/workbench/test/test_scenarios.py +++ b/workbench/test/test_scenarios.py @@ -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 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("