pylint fixes
This commit is contained in:
parent
64523ae8b5
commit
bd12b2a18a
@ -1,14 +1,6 @@
|
||||
import base64
|
||||
from types import SimpleNamespace
|
||||
|
||||
pfctl_stdout_lines = b'''
|
||||
block drop quick proto tcp from <f2b-sendmail-auth> to any port = submission
|
||||
block drop quick proto tcp from <f2b-sendmail-auth> to any port = smtps
|
||||
block drop quick proto tcp from <f2b-sendmail-auth> to any port = smtp
|
||||
block drop quick proto tcp from <f2b-sshd> to any port = ssh
|
||||
block drop quick proto tcp from <f2b-recidive> to any
|
||||
'''
|
||||
|
||||
|
||||
def test_ban_ipv6(client, mocker):
|
||||
def noop():
|
||||
@ -27,9 +19,9 @@ def test_ban_ipv6(client, mocker):
|
||||
json=json_payload,
|
||||
headers={"Authorization": "Basic " + valid_credentials})
|
||||
|
||||
|
||||
assert response.json['operation'] == 'add'
|
||||
|
||||
|
||||
def test_ban_ipv4(client, mocker):
|
||||
def noop():
|
||||
pass
|
||||
@ -47,5 +39,4 @@ def test_ban_ipv4(client, mocker):
|
||||
json=json_payload,
|
||||
headers={"Authorization": "Basic " + valid_credentials})
|
||||
|
||||
|
||||
assert response.json['operation'] == 'add'
|
||||
|
@ -11,7 +11,9 @@ block drop quick proto tcp from <f2b-recidive> to any
|
||||
|
||||
|
||||
def test_request_unauth(client):
|
||||
json_payload = {"port": "any port {pop3,pop3s,imap,imaps,submission,465,sieve}", "name": "dovecot", "protocol": "tcp"}
|
||||
json_payload = {"port":
|
||||
"any port {pop3,pop3s,imap,imaps,submission,465,sieve}",
|
||||
"name": "dovecot", "protocol": "tcp"}
|
||||
response = client.put("/register", json=json_payload)
|
||||
|
||||
assert response.json['error'] == 'Access Denied'
|
||||
@ -26,12 +28,13 @@ def test_request_example(client, mocker):
|
||||
|
||||
mocker.patch('jail2ban.pfctl.run', return_value=run_res)
|
||||
|
||||
|
||||
valid_credentials = base64.b64encode(b"test.example.com:testpassword").decode("utf-8")
|
||||
json_payload = {"port": "any port {pop3,pop3s,imap,imaps,submission,465,sieve}", "name": "dovecot", "protocol": "tcp"}
|
||||
json_payload = {"port":
|
||||
"any port {pop3,pop3s,imap,imaps,submission,465,sieve}",
|
||||
"name": "dovecot", "protocol": "tcp"}
|
||||
|
||||
response = client.put("/register",
|
||||
json=json_payload,
|
||||
headers={"Authorization": "Basic " + valid_credentials})
|
||||
|
||||
|
||||
assert response.json['remote_user'] == 'test.example.com'
|
||||
|
Loading…
x
Reference in New Issue
Block a user