summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Hostbase/test
diff options
context:
space:
mode:
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