Added initial unit tests for RestAPI service.
This commit is contained in:
parent
bb3e62bb4d
commit
29da07cda8
24
portas/portas/tests/sanity_tests.py
Normal file
24
portas/portas/tests/sanity_tests.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import unittest2
|
||||||
|
from mock import MagicMock
|
||||||
|
|
||||||
|
import portas.api.v1.router as router
|
||||||
|
|
||||||
|
def my_mock(link, controller, action, conditions):
|
||||||
|
return [link, controller, action, conditions]
|
||||||
|
|
||||||
|
def func_mock():
|
||||||
|
return True
|
||||||
|
|
||||||
|
class SanityUnitTests(unittest2.TestCase):
|
||||||
|
|
||||||
|
def test_api(self):
|
||||||
|
router.webservers = MagicMock(create_resource=func_mock)
|
||||||
|
router.sessions = MagicMock(create_resource=func_mock)
|
||||||
|
router.active_directories = MagicMock(create_resource=func_mock)
|
||||||
|
router.environments = MagicMock(create_resource=func_mock)
|
||||||
|
mapper = MagicMock(connect=my_mock)
|
||||||
|
|
||||||
|
object = router.API(mapper)
|
||||||
|
|
||||||
|
assert object._router is not None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user