· 6 years ago · Jul 07, 2019, 01:00 AM
1--- original/file_to_fix.py
2+++ fixed/file_to_fix.py
3@@ -1,3 +1,11 @@
4+from mod_honeypot.models import Profile, PiModels, PiPotReport, ProfileService, \\
5+ CollectorTypes, Deployment
6+from mod_config.models import Service, Notification, Actions, Conditions, Rule
7+from mod_auth.models import User, Role, Page, PageAccess
8+from database import create_session, Base
9+from flask import g, current_app
10+from collections import namedtuple
11+import tests.config
12 import os
13 import sys
14 import mock
15@@ -7,14 +15,6 @@
16 # Need to append server root path to ensure we can import the necessary files.
17 sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
18
19-import tests.config
20-from collections import namedtuple
21-from flask import g, current_app
22-from database import create_session, Base
23-from mod_auth.models import User, Role, Page, PageAccess
24-from mod_config.models import Service, Notification, Actions, Conditions, Rule
25-from mod_honeypot.models import Profile, PiModels, PiPotReport, ProfileService, \\
26- CollectorTypes, Deployment
27
28
29 def generate_keys(tempdir):
30@@ -38,20 +38,20 @@
31 secret_csrf = secret_csrf_file.read()
32
33 return {
34- 'TESTING': True,
35- 'WTF_CSRF_ENABLED': False,
36- 'SQLALCHEMY_POOL_SIZE': 1,
37- 'SECRET_KEY': secret_key,
38- 'CSRF_SESSION_KEY': secret_csrf,
39- 'SERVER_IP': '127.0.0.1',
40- 'SERVER_PORT': 443,
41- 'INSTANCE_NAME': 'testInstance',
42- 'APPLICATION_ROOT': '/',
43- 'CSRF_ENABLED': False,
44- 'DATABASE_URI': tests.config.DATABASE_URI,
45- 'COLLECTOR_UDP_PORT': 1234,
46- 'COLLECTOR_SSL_PORT': 1235
47- }
48+ 'TESTING': True,
49+ 'WTF_CSRF_ENABLED': False,
50+ 'SQLALCHEMY_POOL_SIZE': 1,
51+ 'SECRET_KEY': secret_key,
52+ 'CSRF_SESSION_KEY': secret_csrf,
53+ 'SERVER_IP': '127.0.0.1',
54+ 'SERVER_PORT': 443,
55+ 'INSTANCE_NAME': 'testInstance',
56+ 'APPLICATION_ROOT': '/',
57+ 'CSRF_ENABLED': False,
58+ 'DATABASE_URI': tests.config.DATABASE_URI,
59+ 'COLLECTOR_UDP_PORT': 1234,
60+ 'COLLECTOR_SSL_PORT': 1235
61+ }
62
63
64 class BasicTestCase(unittest.TestCase):