Add basic API Server testing framework
This commit is contained in:
parent
596f06d5c0
commit
5b0d662007
40
tests/pylorax/test_server.py
Normal file
40
tests/pylorax/test_server.py
Normal file
@ -0,0 +1,40 @@
|
||||
#
|
||||
# Copyright (C) 2017 Red Hat, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from flask import json
|
||||
from pylorax.api.server import server
|
||||
|
||||
|
||||
class ServerTestCase(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(self):
|
||||
server.config['TESTING'] = True
|
||||
self.server = server.test_client()
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(self):
|
||||
pass
|
||||
|
||||
def test_status(self):
|
||||
"""Test the /api/v0/status route"""
|
||||
status_dict = {"build":"devel", "api":"0", "db_version":"0", "schema_version":"0", "db_supported":False}
|
||||
resp = self.server.get("/api/v0/status")
|
||||
data = json.loads(resp.data)
|
||||
self.assertEqual(data, status_dict)
|
Loading…
Reference in New Issue
Block a user