Skip to content
Snippets Groups Projects
Commit 4aa548d9 authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Adopted to changes in deployit.config.

parent 4b830561
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ import deployit.config
import os
import uuid
import unittest
import logging
managementhost_log_fixtures = [
['1234-a', '19700101T00:00:00+00:00', 'localhost', 'module1', 1, 'nopath', 'POST', '{ "msg": Null }'],
......@@ -23,7 +24,7 @@ class TestDatabase(unittest.TestCase):
def setUp(self):
try:
os.remove(deployit.config.database_config('path'))
os.remove(deployit.config.database['path'])
except:
pass
......@@ -33,11 +34,11 @@ class TestDatabase(unittest.TestCase):
def test_db_initialization(self):
"""Test the initialization of the Database"""
db = managementhost.Database(deployit.config.database_config('path'))
db = managementhost.Database()
def test_add_log(self):
"""Test add log"""
db = managementhost.Database(deployit.config.database_config('path'))
db = managementhost.Database()
[db.add_log(*arg) for arg in managementhost_log_fixtures]
def test_add_invalid_log(self):
......@@ -49,20 +50,20 @@ class TestDatabase(unittest.TestCase):
transaction.
"""
db = managementhost.Database(deployit.config.database_config('path'))
db = managementhost.Database()
with self.assertRaises(Exception):
[db.add_log(*arg) for arg in managementhost_log_invalid_fixtures]
self.assertIsNone(db._get_host_module('module2', 2))
def test_log_retrieval(self):
db = managementhost.Database(deployit.config.database_config('path'))
db = managementhost.Database()
[db.add_log(*arg) for arg in managementhost_log_fixtures]
for fixture in managementhost_log_fixtures:
db.get_log(fixture[0]) == fixture
def test_get_module_logs(self):
db = managementhost.Database(deployit.config.database_config('path'))
db = managementhost.Database()
[db.add_log(*arg) for arg in managementhost_log_fixtures]
logs = db.get_module_logs('module2', 5)
......@@ -70,4 +71,5 @@ class TestDatabase(unittest.TestCase):
if __name__ == '__main__':
logging.basicConfig(log_level=logging.DEBUG)
unittest.main()
......@@ -11,7 +11,7 @@ class TestRestModules(unittest.TestCase):
@classmethod
def setUpClass(cls):
deployit.config.read('testconfig.cfg')
deployit.modules.init_modules(deployit.config.modules_config('path'))
deployit.modules.init_modules(deployit.config.modules['path'])
def test_existence(self):
self.assertIn('Dummy', deployit.modules.modulelist)
......
......@@ -26,7 +26,7 @@ if __name__ == "__main__":
args = parser.parse_args()
deployit.config.read(args.cfgfile)
deployit.modules.init_modules(deployit.config.modules_config('path'))
deployit.modules.init_modules(deployit.config.modules['path'])
# Remove command line argument, because they would be consumed by
# app.run() as well. By doing so, we can't make the server
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment