ソースを参照

Add tests for profile_options

Mike Naberezny 11 年 前
コミット
18c6247b80
1 ファイル変更21 行追加1 行削除
  1. 21 1
      supervisor/tests/test_datatypes.py

+ 21 - 1
supervisor/tests/test_datatypes.py

@@ -581,7 +581,27 @@ class AutoRestartTests(unittest.TestCase):
 
     def test_raises_for_bad_value(self):
         try:
-            self.assertEqual(self._callFUT('bad'))
+            self._callFUT('bad')
             self.fail()
         except ValueError, e:
             self.assertEqual(e.args[0], "invalid 'autorestart' value 'bad'")
+
+class ProfileOptionsTests(unittest.TestCase):
+    def _callFUT(self, arg):
+        from supervisor.datatypes import profile_options
+        return profile_options(arg)
+
+    def test_empty(self):
+        sort_options, callers = self._callFUT('')
+        self.assertEqual([], sort_options)
+        self.assertFalse(callers)
+
+    def test_without_callers(self):
+        sort_options, callers = self._callFUT('CUMULATIVE,calls')
+        self.assertEqual(['cumulative', 'calls'], sort_options)
+        self.assertFalse(callers)
+
+    def test_with_callers(self):
+        sort_options, callers = self._callFUT('cumulative, callers')
+        self.assertEqual(['cumulative'], sort_options)
+        self.assertTrue(callers)