Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3769477
D1192.id3054.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D1192.id3054.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 14:47 (19 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260069
Default Alt Text
D1192.id3054.diff (1 KB)
Attached To
Mode
D1192: Test jails execution module
Attached
Detach File
Event Timeline
Log In to Comment