コード例 #1
0
def no_snmp_connections(monkeypatch):
    close_all_connections()

    def no_snmp(self):
        raise TransportConnectionError(None, None)

    monkeypatch.setattr('modules.transports.SNMPTransport.connect', no_snmp)
コード例 #2
0
#!/usr/bin/env python3

from modules.audit import audit
from modules.database import init_scanning, set_finish_time
from modules.reporting import generate_report
from modules.testing import run_tests
from modules.transports import close_all_connections

if __name__ == '__main__':
    init_scanning()
    audit()
    run_tests()
    close_all_connections()
    set_finish_time()
    generate_report('sample_report.pdf')
コード例 #3
0
def test_000_file_exist_4(run_docker, no_transports):
    close_all_connections()
    assert test.main()[0] == Status.ERROR and test.main()[1]
コード例 #4
0
def test_000_file_exist_3(run_docker, no_ssh_connections):
    close_all_connections()
    assert test.main()[0] == Status.NOT_APPLICABLE
コード例 #5
0
def test_002_permissions_4(run_docker, no_transports):
    close_all_connections()
    assert test.main()[0] == Status.ERROR and test.main()[1]
コード例 #6
0
def test_002_permissions_3(run_docker, no_ssh_connections):
    close_all_connections()
    assert test.main()[0] == Status.NOT_APPLICABLE
コード例 #7
0
def no_transports(monkeypatch):
    close_all_connections()
    monkeypatch.delattr('modules.transports._TRANSPORTS')
コード例 #8
0
def no_mysql_connections(monkeypatch):
    close_all_connections()
    monkeypatch.delattr('pymysql.connect')
コード例 #9
0
def no_ssh_connections(monkeypatch):
    close_all_connections()
    monkeypatch.delattr('paramiko.SSHClient.connect')
コード例 #10
0
def pytest_sessionfinish(session, exitstatus):
    close_all_connections()
コード例 #11
0
 def stop_container():
     close_all_connections()
     containers = docker.from_env().containers.list()
     for container in containers:
         if container.name in started_containers:
             container.stop()