Page MenuHomeDevCentral

No OneTemporary

diff --git a/_tests/data/jails.yaml b/_tests/data/jails.yaml
new file mode 100644
index 0000000..311ac3e
--- /dev/null
+++ b/_tests/data/jails.yaml
@@ -0,0 +1,6 @@
+jails:
+ host:
+ guest1: {}
+ guest2: {}
+ anotherhost:
+ guest3: {}
diff --git a/_tests/modules/test_jails.py b/_tests/modules/test_jails.py
new file mode 100644
index 0000000..7d7bcdb
--- /dev/null
+++ b/_tests/modules/test_jails.py
@@ -0,0 +1,43 @@
+import imp
+import unittest
+
+
+salt_test_case = imp.load_source('salt_test_case', "salt_test_case.py")
+jails = imp.load_source('jails', "../_modules/jails.py")
+
+
+class Testinstance(unittest.TestCase, salt_test_case.SaltTestCase):
+
+ def setUp(self):
+ self.initialize_mocks()
+ self.instance = jails
+
+ self.mock_pillar('data/jails.yaml')
+
+ self.mock_grains()
+ self.grains['id'] = 'host'
+
+ def test_get_default_group(self):
+ self.assertEqual('host', jails._get_default_group())
+
+ def test_get_all_jails(self):
+ self.assertEqual(['anotherhost', 'host'],
+ sorted(jails._get_all_jails().keys()))
+
+ def test_list(self):
+ self.assertEqual(['guest1', 'guest2'],
+ sorted(jails.list()))
+
+ def test_list_for_a_group(self):
+ self.assertEqual(['guest3'],
+ sorted(jails.list('anotherhost')))
+
+ def test_flatlist(self):
+ self.assertEqual("guest1 guest2", jails.flatlist())
+
+ def test_flatlist_for_a_group(self):
+ self.assertEqual("guest3", jails.flatlist('anotherhost'))
+
+
+if __name__ == '__main__':
+ unittest.main()

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 11:13 (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260060
Default Alt Text
(1 KB)

Event Timeline