Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #75 from fastly/zma/rule_enable
Browse files Browse the repository at this point in the history
Added test based rule enabling. Added enabled:false to COOKIEFIXTURE …
  • Loading branch information
zmallen authored Aug 6, 2016
2 parents 68832eb + 7fea79a commit c28dcc4
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
5 changes: 4 additions & 1 deletion ftw/ruleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,11 @@ class Test(object):
def __init__(self, test_dict, ruleset_meta):
self.test_dict = test_dict
self.ruleset_meta = ruleset_meta
self.test_title = test_dict['test_title']
self.test_title = self.test_dict['test_title']
self.stages = self.build_stages()
self.enabled = True
if 'enabled' in self.test_dict:
self.enabled = self.test_dict['enabled']

def build_stages(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from distutils.core import setup

setup(name='ftw',
version='0.1',
version='1.0',
description='Framework for Testing WAFs',
author='Chaim Sanders, Zack Allen',
author_email='[email protected], [email protected]',
Expand Down
3 changes: 2 additions & 1 deletion test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def get_testdata(rulesets):
testdata = []
for ruleset in rulesets:
for test in ruleset.tests:
testdata.append((ruleset, test))
if test.enabled:
testdata.append((ruleset, test))

return testdata

Expand Down
33 changes: 33 additions & 0 deletions test/integration/COOKIEFIXTURE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,36 @@
output:
status: 302
html_contains: "Set-Cookie: TS01293935="
-
test_title: "Multi-Stage w\\ Cookie rule disabled"
enabled: false
stages:
-
stage:
input:
save_cookie: true
dest_addr: "ieee.org"
method: "GET"
port: 80
headers:
User-Agent: "Foo"
Host: "ieee.org"
protocol: "http"
uri: "/"
output:
status: 302
html_contains: "Set-Cookie: TS01293935="
stage:
input:
save_cookie: true
dest_addr: "ieee.org"
method: "GET"
port: 80
headers:
User-Agent: "Foo"
Host: "ieee.org"
protocol: "http"
uri: "/"
output:
status: 302
html_contains: "Set-Cookie: TS01293935="

0 comments on commit c28dcc4

Please sign in to comment.