コード例 #1
0
ファイル: test_db.py プロジェクト: befoulad/ospd-openvas
    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('*')
コード例 #2
0
ファイル: test_db.py プロジェクト: befoulad/ospd-openvas
    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')
コード例 #3
0
ファイル: test_db.py プロジェクト: befoulad/ospd-openvas
 def test_get_key_count_error(self, mock_redis):
     with self.assertRaises(RequiredArgument):
         OpenvasDB.get_key_count(None)
コード例 #4
0
 def get_nvt_count(self) -> int:
     return OpenvasDB.get_key_count(self.ctx, "nvt:*")
コード例 #5
0
 def get_nvt_files_count(self) -> int:
     return OpenvasDB.get_key_count(self.ctx, "filename:*")