summaryrefslogtreecommitdiffstats
path: root/src/lib/Server/Hostbase/test
diff options
context:
space:
mode:
authorDavid Dahl <dahl@mcs.anl.gov>2006-10-11 21:54:30 +0000
committerDavid Dahl <dahl@mcs.anl.gov>2006-10-11 21:54:30 +0000
commit018f2351a8b7a3f9f2ed3b449a5b4744dd5ea19d (patch)
treea1f2d5da620900f103f67c56599aba2b9fc6ce28 /src/lib/Server/Hostbase/test
parent998b31229cdd91a1fd0610596e83addfe28e6e0c (diff)
downloadbcfg2-018f2351a8b7a3f9f2ed3b449a5b4744dd5ea19d.tar.gz
bcfg2-018f2351a8b7a3f9f2ed3b449a5b4744dd5ea19d.tar.bz2
bcfg2-018f2351a8b7a3f9f2ed3b449a5b4744dd5ea19d.zip
added test dir and nose tests and made settings more dynamic
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2430 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Hostbase/test')
-rw-r--r--src/lib/Server/Hostbase/test/harness.py9
-rw-r--r--src/lib/Server/Hostbase/test/test_environ_settings.py35
-rw-r--r--src/lib/Server/Hostbase/test/test_settings.py14
3 files changed, 58 insertions, 0 deletions
diff --git a/src/lib/Server/Hostbase/test/harness.py b/src/lib/Server/Hostbase/test/harness.py
new file mode 100644
index 000000000..05e473609
--- /dev/null
+++ b/src/lib/Server/Hostbase/test/harness.py
@@ -0,0 +1,9 @@
+import os, sys
+
+here = os.path.realpath('harness')
+
+server_hostbase = os.path.realpath(here + '../../../../')
+
+sys.path.insert(0,server_hostbase)
+sys.path.insert(0,server_hostbase + '../')
+sys.path.insert(0,'/home/dahl/Code/bcfg2/src/lib/Server/Hostbase')
diff --git a/src/lib/Server/Hostbase/test/test_environ_settings.py b/src/lib/Server/Hostbase/test/test_environ_settings.py
new file mode 100644
index 000000000..606d87f5d
--- /dev/null
+++ b/src/lib/Server/Hostbase/test/test_environ_settings.py
@@ -0,0 +1,35 @@
+import sys
+import os
+
+
+def env_setup():
+ os.environ['bcfg_db_engine'] = 'foo'
+ os.environ['bcfg_db_name'] = 'bar'
+ os.environ['bcfg_db_user'] = 'baz'
+ os.environ['bcfg_db_password'] = 'pass'
+ os.environ['bcfg_db_host'] = 'biff'
+ os.environ['bcfg_db_port'] = '3306'
+ os.environ['bcfg_time_zone'] = 'CHI'
+
+def teardown():
+ pass
+
+def test_environ_settings():
+
+ os.environ['bcfg_db_engine'] = 'foo'
+ os.environ['bcfg_db_name'] = 'bar'
+ os.environ['bcfg_db_user'] = 'baz'
+ os.environ['bcfg_db_password'] = 'pass'
+ os.environ['bcfg_db_host'] = 'biff'
+ os.environ['bcfg_db_port'] = '3306'
+ os.environ['bcfg_time_zone'] = 'CHI'
+ import Hostbase.settings
+ s = Hostbase.settings
+ s.CFG_TYPE = 'environ'
+ assert s.DATABASE_ENGINE == 'mysql'
+ assert s.DATABASE_PASSWORD == 'pass'
+ assert s.DATABASE_NAME == 'bar'
+ assert s.DATABASE_USER == 'baz'
+ assert s.DATABASE_HOST == 'biff'
+ assert s.DATABASE_PORT == '3306'
+ assert s.TIME_ZONE == 'CHI'
diff --git a/src/lib/Server/Hostbase/test/test_settings.py b/src/lib/Server/Hostbase/test/test_settings.py
new file mode 100644
index 000000000..0040b3ab8
--- /dev/null
+++ b/src/lib/Server/Hostbase/test/test_settings.py
@@ -0,0 +1,14 @@
+import sys
+import os
+import Hostbase.settings
+
+def setup():
+ pass
+
+def teardown():
+ pass
+
+def test_mcs_settings():
+ pass
+
+