Exemplo n.º 1
0
 def test_not_at_least(self):
     with patch.object(utils, 'get_sysctl_value', return_value="0"):
         res = test_sec.test_sysctl_values({"x": ("at_least", "5")})
     self.assertEqual(res.result, Result.FAIL)
Exemplo n.º 2
0
 def test_match(self):
     with patch.object(utils, 'get_sysctl_value', return_value="bar"):
         res = test_sec.test_sysctl_values({"x": ("match", "bar")})
     self.assertEqual(res.result, Result.PASS)
Exemplo n.º 3
0
 def test_not_none_of(self):
     with patch.object(utils, 'get_sysctl_value', return_value="bar"):
         res = test_sec.test_sysctl_values({"x": ("none_of", ["bar", "x"])})
     self.assertEqual(res.result, Result.FAIL)
Exemplo n.º 4
0
 def test_match(self):
     with patch.object(utils, 'get_sysctl_value', return_value="bar"):
         res = test_sec.test_sysctl_values({"x": ("match", "bar")})
     self.assertEqual(res.result, Result.PASS)
Exemplo n.º 5
0
 def test_with_description(self):
     with patch.object(utils, 'get_sysctl_value', return_value="foo"):
         res = test_sec.test_sysctl_values({"x": ("match", "foo", "bar")})
     self.assertEqual(res.results[0]['name'], "bar")
Exemplo n.º 6
0
 def test_not_at_least(self):
     with patch.object(utils, 'get_sysctl_value', return_value="0"):
         res = test_sec.test_sysctl_values({"x": ("at_least", "5")})
     self.assertEqual(res.result, Result.FAIL)
Exemplo n.º 7
0
 def test_not_none_of(self):
     with patch.object(utils, 'get_sysctl_value', return_value="bar"):
         res = test_sec.test_sysctl_values({"x": ("none_of", ["bar", "x"])})
     self.assertEqual(res.result, Result.FAIL)