Page MenuHomeDevCentral

D1192.id3051.diff
No OneTemporary

D1192.id3051.diff

diff --git a/_tests/data/jails.yaml b/_tests/data/jails.yaml
new file mode 100644
--- /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
--- /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/plain
Expires
Sun, Nov 24, 13:47 (18 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260069
Default Alt Text
D1192.id3051.diff (1 KB)

Event Timeline