~larry-e-works/uci-engine/write-exitcode-to-file

« back to all changes in this revision

Viewing changes to nf-stats-service/nfss/tests/functional/__init__.py

  • Committer: Thomi Richards
  • Date: 2014-06-27 20:02:44 UTC
  • mto: (629.2.9 nfss)
  • mto: This revision was merged to the branch mainline in revision 636.
  • Revision ID: thomi.richards@canonical.com-20140627200244-zi7dwxnyw38ypr2f
Initial version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Ubuntu CI Engine
 
2
# Copyright 2014 Canonical Ltd.
 
3
#
 
4
# This program is free software: you can redistribute it and/or modify it
 
5
# under the terms of the GNU Affero General Public License version 3, as
 
6
# published by the Free Software Foundation.
 
7
#
 
8
# This program is distributed in the hope that it will be useful, but
 
9
# WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
# PURPOSE.  See the GNU Affero General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU Affero General Public License
 
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 
 
16
"""Functional test suite for the non functional stats service.
 
17
 
 
18
You must have 'python3-webtest' installed to run these full-stack tests. To
 
19
run these tests, execute:
 
20
 
 
21
$ python3 -m unittest nfss.tests.functional
 
22
 
 
23
"""
 
24
import unittest
 
25
 
 
26
from webtest import TestApp
 
27
 
 
28
import nfss
 
29
 
 
30
 
 
31
class FunctionalTests(unittest.TestCase):
 
32
 
 
33
    def setUp(self):
 
34
        self.testapp = TestApp(nfss.app)
 
35
 
 
36
    def test_root_returns_405(self):
 
37
        res = self.testapp.get('/', status=404)
 
38
        self.assertEqual(res.status_code, 404)
 
39
 
 
40
    def test_v1_api_sets_content_type(self):
 
41
        res = self.testapp.get('/api/v1/')
 
42
        self.assertEqual(res.content_type, 'application/json')