Skip to content
This repository has been archived by the owner on Mar 2, 2024. It is now read-only.

Commit

Permalink
Even more coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien (jvoisin) Voisin committed May 25, 2016
1 parent 6bb2439 commit 10076cc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
from setuptools import setup, find_packages

with open('requirements.txt') as f:
required = map(str.strip, f.read().splitlines())

setup(
name='nxapi',
packages=find_packages(),
version='0.1'
version='0.1',
install_requires=['python-pcre']
)
24 changes: 24 additions & 0 deletions tests/test_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,27 @@ def test_short_str(self):
'var_name0': 'user-agent', 'cscore0': '$UWA', 'id0': '10',
'total_processed': '472', 'vers': '0.52'}
self.assertTrue(processing.check_whitelist(whitelist, nxlog))

whitelist = {'mz': ['$HEADERS_VAR_X:^user-agent$'], 'wl': [42000227, 10]}
nxlog = {'uri': '/phpMyAdmin-2.8.2/scripts/setup.php', 'block': '0',
'total_blocked': '204', 'ip': 'X.X.X.X', 'server': 'Y.Y.Y.Y',
'learning': '0', 'zone0': 'HEADERS', 'score0': '8',
'var_name0': 'user-agent', 'cscore0': '$UWA', 'id0': '10',
'total_processed': '472', 'vers': '0.52'}
self.assertTrue(processing.check_whitelist(whitelist, nxlog))

whitelist = {'mz': ['$HEADERS_VAR_X:^user-agent$'], 'wl': [-40]}
nxlog = {'uri': '/phpMyAdmin-2.8.2/scripts/setup.php', 'block': '0',
'total_blocked': '204', 'ip': 'X.X.X.X', 'server': 'Y.Y.Y.Y',
'learning': '0', 'zone0': 'HEADERS', 'score0': '8',
'var_name0': 'user-agent', 'cscore0': '$UWA', 'id0': '10',
'total_processed': '472', 'vers': '0.52'}
self.assertTrue(processing.check_whitelist(whitelist, nxlog))

whitelist = {'mz': ['$HEADERS_VAR_X:^user-agent$'], 'wl': [-40, -10]}
nxlog = {'uri': '/phpMyAdmin-2.8.2/scripts/setup.php', 'block': '0',
'total_blocked': '204', 'ip': 'X.X.X.X', 'server': 'Y.Y.Y.Y',
'learning': '0', 'zone0': 'HEADERS', 'score0': '8',
'var_name0': 'user-agent', 'cscore0': '$UWA', 'id0': '10',
'total_processed': '472', 'vers': '0.52'}
self.assertTrue(processing.check_whitelist(whitelist, nxlog))

0 comments on commit 10076cc

Please sign in to comment.