~unity-2d-team/unity-2d/Shell-MultiMonitor

« back to all changes in this revision

Viewing changes to grackle/tests/test_wsgi.py

  • Committer: Aaron Bentley
  • Date: 2012-01-10 11:16:56 UTC
  • Revision ID: aaron@canonical.com-20120110111656-9daoyj766z8r184a
Add test framework.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (c) 2012 Canonical Ltd
2
 
#
3
 
# This program is free software: you can redistribute it and/or modify
4
 
# it under the terms of the GNU Affero General Public License as published by
5
 
# the Free Software Foundation, either version 3 of the License, or
6
 
# (at your option) any later version.
7
 
#
8
 
# This program is distributed in the hope that it will be useful,
9
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
# GNU Affero General Public License for more details.
12
 
#
13
 
# You should have received a copy of the GNU Affero General Public
14
 
# License along with this program. If not, see
15
 
# <http://www.gnu.org/licenses/>.
16
 
 
17
 
__metaclass__ = type
18
 
 
19
 
from unittest import TestCase
20
 
 
21
 
from webtest import TestApp
22
 
 
23
 
from grackle.wsgi import app
24
 
 
25
 
 
26
 
class TestRoot(TestCase):
27
 
 
28
 
    def test_get(self):
29
 
        test_app = TestApp(app.wsgifunc())
30
 
        r = test_app.get('/')
31
 
        self.assertEqual(200, r.status_int)
32
 
        r.mustcontain('Service endpoint for Grackle.')
33
 
 
34
 
 
35
 
class TestArchive(TestCase):
36
 
 
37
 
    def test_get(self):
38
 
        test_app = TestApp(app.wsgifunc())
39
 
        r = test_app.get('/archive/foo')
40
 
        self.assertEqual(200, r.status_int)
41
 
        r.mustcontain('Service for archive foo.')