From 418bb176021361f539fe5de13c6af0b316d8e4be Mon Sep 17 00:00:00 2001 From: Six Date: Sat, 10 Apr 2010 17:05:55 -0400 Subject: Initial import of source. --- test/config/connection | 29 ++++++++ test/test_config/config | 19 +++++ test/test_config/config.cfg | 67 +++++++++++++++++ test/test_config/test_db.py | 106 +++++++++++++++++++++++++++ test/test_config/test_file.py | 101 ++++++++++++++++++++++++++ test/test_config/test_init.py | 62 ++++++++++++++++ test/test_config/test_log.py | 147 ++++++++++++++++++++++++++++++++++++++ test/test_config/test_option.py | 53 ++++++++++++++ test/test_config/test_sections.py | 114 +++++++++++++++++++++++++++++ test/test_dodai.py | 38 ++++++++++ 10 files changed, 736 insertions(+) create mode 100644 test/config/connection create mode 100644 test/test_config/config create mode 100644 test/test_config/config.cfg create mode 100644 test/test_config/test_db.py create mode 100644 test/test_config/test_file.py create mode 100644 test/test_config/test_init.py create mode 100644 test/test_config/test_log.py create mode 100644 test/test_config/test_option.py create mode 100644 test/test_config/test_sections.py create mode 100644 test/test_dodai.py (limited to 'test') diff --git a/test/config/connection b/test/config/connection new file mode 100644 index 0000000..36b0414 --- /dev/null +++ b/test/config/connection @@ -0,0 +1,29 @@ +# Copyright (C) 2010 Leonard Thomas +# +# This file is part of Dodai. +# +# Dodai 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 3 of the License, or +# (at your option) any later version. +# +# Dodai 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 Dodai. If not, see . + + +[title] +foo=bar + + +[test_db] +protocol=postgresql +hostname=127.0.0.1 +username=test +password=test +port=12345 +database=testing diff --git a/test/test_config/config b/test/test_config/config new file mode 100644 index 0000000..d3b7019 --- /dev/null +++ b/test/test_config/config @@ -0,0 +1,19 @@ +# Copyright (C) 2010 Leonard Thomas +# +# This file is part of Dodai. +# +# Dodai 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 3 of the License, or +# (at your option) any later version. +# +# Dodai 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 Dodai. If not, see . + +[test_section] +foo=bar diff --git a/test/test_config/config.cfg b/test/test_config/config.cfg new file mode 100644 index 0000000..14764ae --- /dev/null +++ b/test/test_config/config.cfg @@ -0,0 +1,67 @@ +# Copyright (C) 2010 Leonard Thomas +# +# This file is part of Dodai. +# +# Dodai 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 3 of the License, or +# (at your option) any later version. +# +# Dodai 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 Dodai. If not, see . + +[testing] +foo=bar + + + +[test_db] +protocol=postgresql +hostname=127.0.0.1 +username=test +password=test +port=12345 +database=testing +schema=tesuto + +[test_db_two] +protocol=postgre +protocol_extra=psycopg2 +hostname=127.0.0.1 +username=test +password=test +port=12345 +database=testing + +[test_db_three] +protocol=postgresss +hostname=127.0.0.1 +username=test +password=test +port=12345 +database=testing + +[test_db_four] +protocol=postgre +hostname=127.0.0.1 +username=test +password=test +port=tea +database=testing + +[test_db_five] +protocol=postgres +hostname=127.0.0.1 +username=test +password=test +port=12345ad +database=testing + +[test_db_six] +protocol=sqlite +filename=/tmp/test diff --git a/test/test_config/test_db.py b/test/test_config/test_db.py new file mode 100644 index 0000000..ed46eae --- /dev/null +++ b/test/test_config/test_db.py @@ -0,0 +1,106 @@ +# Copyright (C) 2010 Leonard Thomas +# +# This file is part of Dodai. +# +# Dodai 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 3 of the License, or +# (at your option) any later version. +# +# Dodai 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 Dodai. If not, see . + +import unittest +import os +from dodai.config.db import ConfigDb +from dodai.config.db import ConfigDbFile +from dodai.config.db import BaseConfigDb +from dodai.config.db import NotConfigParserObject +from dodai.config.db import InvalidProtocolException +from dodai.config.db import InvalidPortException +from dodai.config.db import UnknownHandlerException +from dodai.config.db import UnknownConnectionException +from dodai.config.db.sa import Sa +from dodai.config.file import ConfigFile +from dodai.db import Db + +class TestConfigDb(unittest.TestCase): + + + def setUp(self): + self.config_db = ConfigDb() + config = ConfigFile() + config.set_directory(os.path.dirname(os.path.abspath(__file__))) + config.load('config.cfg') + self.parser = config.parser() + + def test_setup(self): + obj = self.config_db._handlers['sa'][0] + self.assertTrue(obj == Sa) + + def test_register_handler(self): + self.config_db.register_handler('foo', Exception) + self.assertTrue('foo' in self.config_db._handlers.keys()) + + def test_add_config_one(self): + self.config_db.add_config(config_parser=self.parser) + self.assertTrue('test_db' in self.config_db.connections.keys()) + + def test_add_config_two(self): + self.failUnlessRaises(NotConfigParserObject, self.config_db.add_config, + config_parser='blah') + + def test_load_one(self): + self.config_db.add_config(config_parser=self.parser) + obj = self.config_db.load('test_db') + self.assertTrue(isinstance(obj, Db)) + + def test_load_two(self): + self.config_db.add_config(config_parser=self.parser) + obj = self.config_db.load('test_db') + obj = self.config_db.load('test_db') + self.assertTrue(isinstance(obj, Db)) + + def test_load_handler(self): + self.failUnlessRaises(UnknownHandlerException, + self.config_db._load_handler, 'test') + + def test_clean_protocol_one(self): + self.config_db.add_config(config_parser=self.parser) + obj = self.config_db.load('test_db_two') + self.assertTrue(isinstance(obj, Db)) + + def test_clean_protocol_one(self): + self.config_db.add_config(config_parser=self.parser) + obj = self.config_db.load('test_db_two') + self.assertTrue(isinstance(obj, Db)) + + def test_clean_protocol_two(self): + self.config_db.add_config(config_parser=self.parser) + self.failUnlessRaises(InvalidProtocolException, self.config_db.load, + 'test_db_three') + + def test_clean_port_one(self): + obj = BaseConfigDb() + data = obj._clean_port('ad') + self.assertTrue(data == None) + + def test_clean_port_two(self): + obj = BaseConfigDb() + data = obj._clean_port(None) + self.assertTrue(data == None) + + def test_clean_port_three(self): + obj = BaseConfigDb() + self.failUnlessRaises(InvalidPortException, obj._clean_port, 66666) + + + def test_file_load_one(self): + self.config_db.add_config(config_parser=self.parser) + obj = self.config_db.load('test_db_six') + self.assertTrue(isinstance(obj, Db)) diff --git a/test/test_config/test_file.py b/test/test_config/test_file.py new file mode 100644 index 0000000..1ed014e --- /dev/null +++ b/test/test_config/test_file.py @@ -0,0 +1,101 @@ +# Copyright (C) 2010 Leonard Thomas +# +# This file is part of Dodai. +# +# Dodai 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 3 of the License, or +# (at your option) any later version. +# +# Dodai 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 Dodai. If not, see . + +import unittest +import os +from dodai.config.file import ConfigFile +from dodai.config.file import DirectoryDoesNotExistException +from dodai.config.file import DirectoryNotSetException +from dodai.config.file import InvalidDirectoryException +from dodai.config.file import FileDoesNotExistException +from dodai.config.file import NoFilesToLoadException +import ConfigParser + +class TestConfigFile(unittest.TestCase): + + def setUp(self): + self.obj = ConfigFile() + self.path = os.path.dirname(__file__) + self.filename = 'config' + self.filepath = os.path.join(self.path, self.filename) + next_file = os.path.join(self.path, 'config.cfg') + self.paths = [self.filepath, next_file] + + def test_file_add(self): + self.obj.add_file(self.filepath) + paths = [self.filepath] + files = self.obj.get_files() + self.assertEqual(files, paths) + + def test_double_file_add(self): + self.obj.add_file(self.filepath) + self.obj.add_file(self.filepath) + paths = [self.filepath] + files = self.obj.get_files() + self.assertEqual(files, paths) + + def test_file_does_not_exist(self): + path = os.path.join(self.path, 'foo') + self.failUnlessRaises(FileDoesNotExistException, + self.obj.add_file, path) + + def test_multiple_file_add(self): + self.obj.add_file(self.paths) + files = self.obj.get_files() + self.assertEqual(files, self.paths) + + def test_empty_parser(self): + self.failUnlessRaises(Exception, self.obj.parser) + + def test_parser(self): + self.obj.add_file(self.filepath) + parser = self.obj.parser() + self.assertTrue(isinstance(parser, ConfigParser.ConfigParser)) + + def test_parser_error(self): + self.failUnlessRaises(NoFilesToLoadException, self.obj.parser) + + def test_set_directory(self): + self.obj.set_directory(self.path) + dir = self.obj.get_directory() + self.assertEqual(dir, self.path) + + def test_invalid_directory(self): + self.failUnlessRaises(InvalidDirectoryException, + self.obj.set_directory, self.filepath) + + def test_directory_does_not_exist(self): + path = os.path.join(self.path, 'nowayjose') + self.failUnlessRaises(DirectoryDoesNotExistException, + self.obj.set_directory, path) + + def test_load(self): + self.obj.set_directory(self.path) + self.obj.load(self.filename) + check = [self.filepath] + self.assertEqual(check, self.obj.get_files()) + + def test_no_directory_set(self): + self.failUnlessRaises(DirectoryNotSetException, + self.obj.load, self.filename) + + def test_reset_parser(self): + self.obj.add_file(self.filepath) + self.obj.parser() + self.obj.add_file(self.paths) + self.obj.parser() + self.assertEqual(self.obj.files_loaded, self.obj.get_files()) diff --git a/test/test_config/test_init.py b/test/test_config/test_init.py new file mode 100644 index 0000000..92b44c6 --- /dev/null +++ b/test/test_config/test_init.py @@ -0,0 +1,62 @@ +# Copyright (C) 2010 Leonard Thomas +# +# This file is part of Dodai. +# +# Dodai 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 3 of the License, or +# (at your option) any later version. +# +# Dodai 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 Dodai. If not, see . + +import unittest +from dodai.config import Config +from dodai.config.option import ConfigOption +from dodai.config.file import ConfigFile +from dodai.config.log import ConfigLog +from dodai.config import ConfigResults +from dodai.config.db import ConfigDb + +class TestConfig(unittest.TestCase): + + def setUp(self): + self.obj = Config() + + def test_set_one(self): + self.obj.set('foo', 'bar') + self.assertTrue('foo' in self.obj.vars.keys()) + + def test_set_two(self): + self.obj.set('foo', 'bar') + self.assertTrue('bar' == self.obj.vars['foo']) + + def test_options(self): + obj = self.obj.options() + self.assertTrue(isinstance(obj, ConfigOption)) + + def test_files(self): + obj = self.obj.files() + self.assertTrue(isinstance(obj, ConfigFile)) + + def test_logs(self): + obj = self.obj.logs() + self.assertTrue(isinstance(obj, ConfigLog)) + + def test_call_one(self): + obj = self.obj() + self.assertTrue(isinstance(obj, ConfigResults)) + + def test_call_two(self): + self.obj.set('foo', 'bar') + obj = self.obj() + self.assertTrue(obj.foo == 'bar') + + def test_db_one(self): + obj = self.obj.dbs() + self.assertTrue(isinstance(obj, ConfigDb)) diff --git a/test/test_config/test_log.py b/test/test_config/test_log.py new file mode 100644 index 0000000..d3c46bc --- /dev/null +++ b/test/test_config/test_log.py @@ -0,0 +1,147 @@ +# Copyright (C) 2010 Leonard Thomas +# +# This file is part of Dodai. +# +# Dodai 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 3 of the License, or +# (at your option) any later version. +# +# Dodai 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 Dodai. If not, see . + +import unittest +import os +import logging +from logging import Logger +from dodai.config.log import ConfigLog +from dodai.config.log import NoDirectoryExistException +from dodai.config.log import DirectoryNotSetException +from dodai.config.log import InvalidLevelException +from logging.handlers import RotatingFileHandler +from logging import StreamHandler + +class TestConfigLog(unittest.TestCase): + + + def setUp(self): + self.obj = ConfigLog() + self.path = os.path.dirname(__file__) + self.filename = 'test_log_file' + self.filepath = os.path.join(self.path, self.filename) + + def tearDown(self): + if os.path.isfile(self.filepath): + os.remove(self.filepath) + + def test_set_log_level_one(self): + self.obj.set_log_level(logging.INFO) + self.assertTrue(self.obj.log_level == logging.INFO) + + def test_set_log_level_two(self): + self.obj.set_log_level('wArnIng') + self.assertTrue(self.obj.log_level == logging.WARNING) + + def test_set_log_level_three(self): + default = self.obj.log_level + self.obj.set_log_level('i08w9umY3ngas') + self.assertTrue(self.obj.log_level == default) + + def test_fetch_log_level_one(self): + level = self.obj._fetch_log_level(logging.DEBUG) + self.assertTrue(level == logging.DEBUG) + + def test_fetch_log_level_two(self): + level = self.obj._fetch_log_level('ErRoR') + self.assertTrue(level == logging.ERROR) + + def test_fetch_log_level_three(self): + self.failUnlessRaises(InvalidLevelException, + self.obj._fetch_log_level, + 'ba_ri08w9as') + + def test_get_file_message_format(self): + default = self.obj.LEVELS[logging.DEBUG][1] + out = self.obj.get_file_message_format(logging.DEBUG) + self.assertTrue(default == out) + + def test_get_screen_message_format(self): + default = self.obj.LEVELS[logging.WARNING][2] + out = self.obj.get_screen_message_format(logging.WARNING) + self.assertTrue(default == out) + + def test_set_directory_one(self): + self.obj.set_directory(self.path) + self.assertTrue(self.obj.directory == self.path) + + def test_set_directory_two(self): + self.failUnlessRaises(NoDirectoryExistException, + self.obj.set_directory, + __file__) + + def test_load_one(self): + log = self.obj.load('test') + self.assertTrue(isinstance(log, Logger)) + + def test_build_filepath_one(self): + path = self.obj._build_filepath(self.filepath) + self.assertTrue(self.filepath == path) + + def test_build_filepath_two(self): + self.obj.set_directory(self.path) + path = self.obj._build_filepath(self.filename) + self.assertTrue(self.filepath == path) + + def test_build_filepath_three(self): + self.failUnlessRaises(NoDirectoryExistException, + self.obj._build_filepath, + os.path.join(__file__, 'blah')) + + def test_build_filepath_four(self): + self.failUnlessRaises(DirectoryNotSetException, + self.obj._build_filepath, + self.filename) + + def test_attach_file_handler(self): + self.obj.set_log_level(logging.WARNING) + self.obj.set_directory(self.path) + log = self.obj.load('test') + self.obj.attach_file_handler(log, self.filename) + handlers = log.handlers + has_stream = False + for handle in handlers: + print handle + if isinstance(handle, RotatingFileHandler): + has_stream = True + self.assertTrue(has_stream, 'RotatingFileHandler is missing') + + def test_attach_screen_handler_one(self): + self.obj.set_log_level(logging.DEBUG) + self.obj.set_directory(self.path) + log = self.obj.load('testing') + self.obj.attach_screen_handler(log, logging.CRITICAL) + handlers = log.handlers + has_stream = False + for handle in handlers: + print handle + if isinstance(handle, StreamHandler): + has_stream = True + self.assertTrue(has_stream, 'StreamHandler is missing') + + def test_attach_screen_handler_two(self): + self.obj.set_log_level(logging.DEBUG) + self.obj.set_directory(self.path) + log = self.obj.load('testing') + self.obj.attach_screen_handler(log) + handlers = log.handlers + has_stream = False + for handle in handlers: + print handle + if isinstance(handle, StreamHandler): + has_stream = True + self.assertTrue(has_stream, 'StreamHandler is missing') diff --git a/test/test_config/test_option.py b/test/test_config/test_option.py new file mode 100644 index 0000000..3fc9e6f --- /dev/null +++ b/test/test_config/test_option.py @@ -0,0 +1,53 @@ +# Copyright (C) 2010 Leonard Thomas +# +# This file is part of Dodai. +# +# Dodai 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 3 of the License, or +# (at your option) any later version. +# +# Dodai 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 Dodai. If not, see . + +import unittest +from dodai.config.option import ConfigOption +from optparse import OptionParser + +class TestConfigOption(unittest.TestCase): + + def setUp(self): + self.obj = ConfigOption() + + def test_parser(self): + self.assertTrue(isinstance(self.obj.parser, OptionParser)) + + def test_add_quiet(self): + self.obj.add_quiet() + self.assertTrue(self.obj.parser.has_option('-q')) + + def test_add_verbose(self): + self.obj.add_verbose() + self.assertTrue(self.obj.parser.has_option('-v')) + + def test_add_log_level(self): + self.obj.add_log_level('critical') + self.assertTrue(self.obj.parser.has_option('-l')) + + def test_add_setup(self): + self.obj.add_setup() + self.assertTrue(self.obj.parser.has_option('--setup')) + + def test_get_args(self): + args = self.obj.get_args() + self.assertTrue(args == []) + + def test_get_options(self): + self.obj.add_quiet() + options = self.obj.get_options() + self.assertTrue(options.verbose == True) diff --git a/test/test_config/test_sections.py b/test/test_config/test_sections.py new file mode 100644 index 0000000..2aba3c7 --- /dev/null +++ b/test/test_config/test_sections.py @@ -0,0 +1,114 @@ +# Copyright (C) 2010 Leonard Thomas +# +# This file is part of Dodai. +# +# Dodai 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 3 of the License, or +# (at your option) any later version. +# +# Dodai 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 Dodai. If not, see . + +import sys +import os +import ConfigParser +import unittest +path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..')) +sys.path.append(path) +from dodai.tools.himo import Himo +from dodai.config.sections import ConfigSections + + +class TestSections(unittest.TestCase): + + def setUp(self): + path = os.path.dirname(__file__) + filepath = os.path.join(path, 'config.cfg') + self.parser = ConfigParser.ConfigParser() + self.parser.readfp(open(filepath)) + self.sections = ConfigSections(Himo) + + def test_call(self): + self.sections(self.parser) + count = len(self.parser.sections()) + self.assertEqual(count, len(self.sections)) + + def test_iterator(self): + result = True + for section in self.sections: + if not section.get_title() in self.parser.sections(): + result = False + self.assertTrue(result==True) + + def test_get_section(self): + self.sections(self.parser) + self.sections(self.parser) + check = self.sections.get_section('test_db') + self.assertEqual(check.get_title(), 'test_db') + + def test_build_string_object(self): + sections = ConfigSections() + sections(self.parser) + count = len(self.parser.sections()) + self.assertEqual(count, len(sections)) + + def test_getitem(self): + self.sections(self.parser) + title = self.sections['test_db'].get_title() + self.assertEqual(title, 'test_db') + + def test_getattr(self): + self.sections(self.parser) + title = self.sections.test_db.get_title() + self.assertEqual(title, 'test_db') + + def test_get_keys(self): + self.sections(self.parser) + keys = self.sections.keys() + self.assertTrue(len(keys)) + + def test_section_object_one(self): + self.sections(self.parser) + keys = self.sections.test_db.keys() + self.assertTrue(len(keys)) + + def test_section_object_two(self): + self.sections(self.parser) + keys = self.sections.test_db.___options___.keys() + self.assertTrue(len(keys)) + + def test_section_object_three(self): + self.sections(self.parser) + self.sections.test_db.___blah___ = 'test' + val = self.sections.test_db.__getattr__('___blah___') + self.assertTrue(val == 'test') + + def test_section_object_four(self): + self.sections(self.parser) + self.sections.test_db.foo = 'bar' + val = self.sections.test_db.__getattr__('foo') + self.assertTrue(val == 'bar') + + def test_section_object_five(self): + self.sections(self.parser) + keys = [] + for key in self.sections.test_db: + keys.append(key) + self.assertTrue(keys) + + def test_section_object_six(self): + self.sections(self.parser) + self.sections.test_db.foo = 'bar' + val = self.sections.test_db['foo'] + self.assertTrue(val == 'bar') + + + +if __name__ == '__main__': + unittest.main() diff --git a/test/test_dodai.py b/test/test_dodai.py new file mode 100644 index 0000000..a521a38 --- /dev/null +++ b/test/test_dodai.py @@ -0,0 +1,38 @@ +# Copyright (C) 2010 Leonard Thomas +# +# This file is part of Dodai. +# +# Dodai 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 3 of the License, or +# (at your option) any later version. +# +# Dodai 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 Dodai. If not, see . + +import unittest +import os +from dodai import Configure + +class TestConfigure(unittest.TestCase): + + def setUp(self): + path = os.path.dirname(os.path.abspath(__file__)) + path = os.path.join(path, 'config') + filename = os.path.join(path, 'connection') + self.filename = filename + self.obj = Configure('test', config_files=[filename]) + + def test_results(self): + files = self.obj.config_files + self.assertTrue(len(files) == 1) + + def test_add_files(self): + self.obj._add_files(self.filename) + files = self.obj.config_files + self.assertTrue(len(files) == 1) -- cgit v1.2.3