Beispiel #1
0
    def test_get_key_count_with_default_pattern(self, mock_redis):
        ctx = mock_redis.return_value

        ctx.keys.return_value = ['aa', 'ab']

        ret = OpenvasDB.get_key_count(ctx)

        self.assertEqual(ret, 2)
        ctx.keys.assert_called_with('*')
Beispiel #2
0
    def test_get_key_count(self, mock_redis):
        ctx = mock_redis.return_value

        ctx.keys.return_value = ['aa', 'ab']

        ret = OpenvasDB.get_key_count(ctx, "foo")

        self.assertEqual(ret, 2)
        ctx.keys.assert_called_with('foo')
Beispiel #3
0
 def test_get_key_count_error(self, mock_redis):
     with self.assertRaises(RequiredArgument):
         OpenvasDB.get_key_count(None)
Beispiel #4
0
 def get_nvt_count(self) -> int:
     return OpenvasDB.get_key_count(self.ctx, "nvt:*")
Beispiel #5
0
 def get_nvt_files_count(self) -> int:
     return OpenvasDB.get_key_count(self.ctx, "filename:*")