summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Hostbase/test
diff options
context:
space:
mode:
authorSol Jerome <sol.jerome@gmail.com>2012-03-24 11:20:07 -0500
committerSol Jerome <sol.jerome@gmail.com>2012-03-24 11:20:07 -0500
commitdab1d03d81c538966d03fb9318a4588a9e803b44 (patch)
treef51e27fa55887e9fb961766805fe43f0da56c5b9 /src/lib/Bcfg2/Server/Hostbase/test
parent5cd6238df496a3cea178e4596ecd87967cce1ce6 (diff)
downloadbcfg2-dab1d03d81c538966d03fb9318a4588a9e803b44.tar.gz
bcfg2-dab1d03d81c538966d03fb9318a4588a9e803b44.tar.bz2
bcfg2-dab1d03d81c538966d03fb9318a4588a9e803b44.zip
Allow to run directly from a git checkout (#1037)
Signed-off-by: Sol Jerome <sol.jerome@gmail.com>
Diffstat (limited to 'src/lib/Bcfg2/Server/Hostbase/test')
-rw-r--r--src/lib/Bcfg2/Server/Hostbase/test/harness.py11
-rw-r--r--src/lib/Bcfg2/Server/Hostbase/test/test_environ_settings.py35
-rw-r--r--src/lib/Bcfg2/Server/Hostbase/test/test_ldapauth.py10
-rw-r--r--src/lib/Bcfg2/Server/Hostbase/test/test_settings.py12
4 files changed, 68 insertions, 0 deletions
diff --git a/src/lib/Bcfg2/Server/Hostbase/test/harness.py b/src/lib/Bcfg2/Server/Hostbase/test/harness.py
new file mode 100644
index 000000000..befcff5c0
--- /dev/null
+++ b/src/lib/Bcfg2/Server/Hostbase/test/harness.py
@@ -0,0 +1,11 @@
+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 + '../')
+#commented this out, but might be needed for now until the harness is figured out
+#if so, use your actual path to the Hostbase module
+#sys.path.insert(0,'/home/dahl/Code/bcfg2/src/lib/Server/Hostbase')
diff --git a/src/lib/Bcfg2/Server/Hostbase/test/test_environ_settings.py b/src/lib/Bcfg2/Server/Hostbase/test/test_environ_settings.py
new file mode 100644
index 000000000..ad35c624e
--- /dev/null
+++ b/src/lib/Bcfg2/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/Bcfg2/Server/Hostbase/test/test_ldapauth.py b/src/lib/Bcfg2/Server/Hostbase/test/test_ldapauth.py
new file mode 100644
index 000000000..7fc009ad2
--- /dev/null
+++ b/src/lib/Bcfg2/Server/Hostbase/test/test_ldapauth.py
@@ -0,0 +1,10 @@
+import os,sys
+import harness
+
+from Hostbase.ldapauth import *
+
+def test_it():
+ l = ldapauth(os.environ['LDAP_SVC_ACCT_NAME'],
+ os.environ['LDAP_SVC_ACCT_PASS'])
+
+ assert l.department == 'foo'
diff --git a/src/lib/Bcfg2/Server/Hostbase/test/test_settings.py b/src/lib/Bcfg2/Server/Hostbase/test/test_settings.py
new file mode 100644
index 000000000..0dfc30f38
--- /dev/null
+++ b/src/lib/Bcfg2/Server/Hostbase/test/test_settings.py
@@ -0,0 +1,12 @@
+import sys
+import os
+import Hostbase.settings
+
+def setup():
+ pass
+
+def teardown():
+ pass
+
+def test_mcs_settings():
+ pass