From 46db573e3c6301a995c1e696ceb677c8f6abd836 Mon Sep 17 00:00:00 2001 From: Dan Colish Date: Sat, 2 Apr 2011 16:40:09 -0700 Subject: [PATCH] add a simple test to see if most url endpoints work, fix failures --- lodgeit/views/json.html | 12 +++++++----- lodgeit/views/xmlrpc.html | 11 ++++++----- tests/__init__.py | 4 ++++ tests/alfajor.ini | 9 +++++++++ tests/unittest/__init__.py | 0 tests/unittest/test_urls.py | 17 +++++++++++++++++ tests/utilities/__init__.py | 1 + tests/utilities/runner.py | 9 +++++++++ 8 files changed, 53 insertions(+), 10 deletions(-) create mode 100644 tests/__init__.py create mode 100644 tests/alfajor.ini create mode 100644 tests/unittest/__init__.py create mode 100644 tests/unittest/test_urls.py create mode 100644 tests/utilities/__init__.py create mode 100644 tests/utilities/runner.py diff --git a/lodgeit/views/json.html b/lodgeit/views/json.html index 3512e7f..5a03812 100644 --- a/lodgeit/views/json.html +++ b/lodgeit/views/json.html @@ -6,11 +6,13 @@

{% trans %}JSON Entrypoint{% endtrans %}

{% trans %} This is the entrypoint for the JSON API. If you're interested - in using it head over to the API documentation. - {%- endtrans %} + in using it head over to the {%- endtrans %} + {% trans %}API documentation{% endtrans %}. + +

+

{% trans %}Alternatively you can also use the {% endtrans %} + XMLRPC{% trans %}service. + {% endtrans %}

-

{% trans %} - Alternatively you can also use the XMLRPC service. - {% endtrans %}

{% endblock %} diff --git a/lodgeit/views/xmlrpc.html b/lodgeit/views/xmlrpc.html index 598b49b..0c33303 100644 --- a/lodgeit/views/xmlrpc.html +++ b/lodgeit/views/xmlrpc.html @@ -6,11 +6,12 @@

{% trans %}XMLRPC Entrypoint{% endtrans %}

{% trans %} This is the entrypoint for the XMLRPC system. If you're interested - in using it head over to the API documentation. - {%- endtrans %} + in using it head over to the {% endtrans %} + API {% trans %}documentation{%- endtrans %}. +

+

+ {% trans %}Alternatively you can also use the {% endtrans %} + JSONAPI.

-

{% trans %} - Alternatively you can also use the JSON API. - {% endtrans %}

{% endblock %} diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..b6c003d --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,4 @@ +from alfajor import APIClient + +client = APIClient() +client.configure_in_scope('default') diff --git a/tests/alfajor.ini b/tests/alfajor.ini new file mode 100644 index 0000000..315ba8e --- /dev/null +++ b/tests/alfajor.ini @@ -0,0 +1,9 @@ +[default-targets] +default+apiclient=wsgi + +[default] +wsgi=wsgi + +[default+apiclient.wsgi] +server-entry-point = tests.utilities:foo +base_url = http://www.localhost:5001 diff --git a/tests/unittest/__init__.py b/tests/unittest/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/unittest/test_urls.py b/tests/unittest/test_urls.py new file mode 100644 index 0000000..781024d --- /dev/null +++ b/tests/unittest/test_urls.py @@ -0,0 +1,17 @@ +from tests import client + + +def test_load_most_urls(): + rules = ['/', + '/compare/', + '/all/', + '/all/1/', + '/xmlrpc/', + '/json/', + '/about/', + '/help/', + '/help/json/', + '/colorscheme/', + '/language/es/'] + for rule in rules: + client.get(rule) diff --git a/tests/utilities/__init__.py b/tests/utilities/__init__.py new file mode 100644 index 0000000..fbf85b6 --- /dev/null +++ b/tests/utilities/__init__.py @@ -0,0 +1 @@ +from .runner import foo diff --git a/tests/utilities/runner.py b/tests/utilities/runner.py new file mode 100644 index 0000000..a5da7ae --- /dev/null +++ b/tests/utilities/runner.py @@ -0,0 +1,9 @@ +from werkzeug import create_environ +from lodgeit.application import make_app + + +foo = make_app('sqlite://', 'NONE', False, True) + + +def setup(): + pass