forked from dnstwister/dnstwister
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
38 lines (27 loc) · 815 Bytes
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
""" Test setup."""
import sys
import flask_webtest
import httpretty
import pytest
import dnstwister
# Add dnstwister to import path
sys.path.insert(0, 'dnstwister')
@pytest.fixture
def webapp():
"""Create a webapp fixture for accessing the site.
Just include 'webapp' as an argument to the test method to use.
"""
# Create a webtest Test App for use
testapp = flask_webtest.TestApp(dnstwister.app)
testapp.app.debug = True
# Clear the cache
dnstwister.cache.clear()
return testapp
@pytest.yield_fixture
def f_httpretty():
"""httpretty doesn't work with pytest fixtures in python 2..."""
httpretty.enable()
httpretty.HTTPretty.allow_net_connect = False
yield httpretty
httpretty.disable()
httpretty.reset()