Codebase list python-faraday / 8202504
Refresh patches Sophie Brun 3 years ago
4 changed file(s) with 95 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
22 Subject: Remove failing tests
33
44 ---
5 tests/test_api_login.py | 167 -------------------------
6 tests/test_server_utils_filters.py | 241 -------------------------------------
7 2 files changed, 408 deletions(-)
5 tests/test_api_login.py | 235 ----------------------------------
6 tests/test_server_utils_filters.py | 249 -------------------------------------
7 2 files changed, 484 deletions(-)
88 delete mode 100644 tests/test_api_login.py
99 delete mode 100644 tests/test_server_utils_filters.py
1010
1111 diff --git a/tests/test_api_login.py b/tests/test_api_login.py
1212 deleted file mode 100644
13 index c08f0a0..0000000
13 index 3e8a519..0000000
1414 --- a/tests/test_api_login.py
1515 +++ /dev/null
16 @@ -1,167 +0,0 @@
16 @@ -1,235 +0,0 @@
1717 -
1818 -import pytest
1919 -from flask_security.utils import hash_password
2525 -from tests.conftest import logged_user, login_as
2626 -
2727 -
28 -class TestLogin():
28 -class TestLogin:
2929 - def test_case_bug_with_username(self, test_client, session):
3030 - """
3131 - When the user case does not match the one in database,
120120 - test_client.cookie_jar.clear()
121121 - res = test_client.get('/v2/ws/wonderland/', headers=headers)
122122 - assert res.status_code == 200
123 - assert res.headers.has_key('Set-Cookie') is False
123 - assert 'Set-Cookie' not in res.headers
124124 - cookies = [cookie.name for cookie in test_client.cookie_jar]
125125 - assert "faraday_session_2" not in cookies
126126 -
181181 -
182182 - ws = test_client.get('/v2/ws/wonderland/', headers=headers)
183183 - assert ws.status_code == 200
184 -
185 - def test_login_remember_me(self, test_client, session):
186 - """
187 - When the remember me option is true, flask stores a remember_token
188 - """
189 - test_client.cookie_jar.clear()
190 - susan = factories.UserFactory.create(
191 - active=True,
192 - username='susan',
193 - password=hash_password('pepito'),
194 - role='pentester')
195 - session.add(susan)
196 - session.commit()
197 -
198 - login_payload = {
199 - 'email': 'susan',
200 - 'password': 'pepito',
201 - 'remember': True
202 - }
203 - res = test_client.post('/login', data=login_payload)
204 - assert res.status_code == 200
205 - cookies = [cookie.name for cookie in test_client.cookie_jar]
206 - assert "remember_token" in cookies
207 -
208 - def test_login_not_remember_me(self, test_client, session):
209 - """
210 - When the remember me option is false, flask dont stores a remember_token
211 - """
212 -
213 - test_client.cookie_jar.clear()
214 - susan = factories.UserFactory.create(
215 - active=True,
216 - username='susan',
217 - password=hash_password('pepito'),
218 - role='pentester')
219 - session.add(susan)
220 - session.commit()
221 - login_payload = {
222 - 'email': 'susan',
223 - 'password': 'pepito',
224 - 'remember': False
225 - }
226 - res = test_client.post('/login', data=login_payload)
227 - assert res.status_code == 200
228 - cookies = [cookie.name for cookie in test_client.cookie_jar]
229 - assert "remember_token" not in cookies
230 -
231 - def test_login_without_remember_me(self, test_client, session):
232 - """
233 - When the remember me option is missing, flask dont stores a remember_token
234 - """
235 -
236 - test_client.cookie_jar.clear()
237 - susan = factories.UserFactory.create(
238 - active=True,
239 - username='susan',
240 - password=hash_password('pepito'),
241 - role='pentester')
242 - session.add(susan)
243 - session.commit()
244 - login_payload = {
245 - 'email': 'susan',
246 - 'password': 'pepito'
247 - }
248 - res = test_client.post('/login', data=login_payload)
249 - assert res.status_code == 200
250 - cookies = [cookie.name for cookie in test_client.cookie_jar]
251 - assert "remember_token" not in cookies
184252 diff --git a/tests/test_server_utils_filters.py b/tests/test_server_utils_filters.py
185253 deleted file mode 100644
186 index 1d57c61..0000000
254 index efde1ed..0000000
187255 --- a/tests/test_server_utils_filters.py
188256 +++ /dev/null
189 @@ -1,241 +0,0 @@
257 @@ -1,249 +0,0 @@
190258 -import pytest
191259 -
192260 -from marshmallow.exceptions import ValidationError
193261 -
194262 -from faraday.server.utils.filters import FilterSchema
195263 -from faraday.server.utils.filters import FlaskRestlessSchema
264 -from faraday.server.models import VulnerabilityWeb
196265 -
197266 -
198267 -class TestFilters:
428497 -
429498 - res = FilterSchema().load(filters)
430499 - assert res == filters
500 -
501 - def test_case_filter_invalid_attr(self):
502 - filters = {'filters': [
503 - {"name": "columna_pepe", "op": "has", "val": "Linux"}
504 - ]}
505 - with pytest.raises(ValidationError):
506 - FilterSchema().load(filters)
1515 2 files changed, 5 insertions(+), 8 deletions(-)
1616
1717 diff --git a/faraday/manage.py b/faraday/manage.py
18 index 801384b..4a09639 100755
18 index 16d8f57..ecde322 100755
1919 --- a/faraday/manage.py
2020 +++ b/faraday/manage.py
21 @@ -112,9 +112,9 @@ def sql_shell():
21 @@ -126,9 +126,9 @@ def sql_shell():
2222 @click.command(help='Checks configuration and faraday status.')
2323 @click.option('--check_postgresql', default=False, is_flag=True)
2424 @click.option('--check_faraday', default=False, is_flag=True)
3030
3131 selected = False
3232 exit_code = 0
33 @@ -128,9 +128,9 @@ def status_check(check_postgresql, check_faraday, check_dependencies, check_conf
33 @@ -142,9 +142,9 @@ def status_check(check_postgresql, check_faraday, check_dependencies, check_conf
3434 status_check_functions.print_faraday_status()
3535 selected = True
3636
4444 if check_config:
4545 status_check_functions.print_config_status()
4646 diff --git a/faraday/start_server.py b/faraday/start_server.py
47 index 0827755..7d6aabe 100644
47 index e16b9b8..682e85d 100644
4848 --- a/faraday/start_server.py
4949 +++ b/faraday/start_server.py
50 @@ -108,7 +108,6 @@ def main():
50 @@ -110,7 +110,6 @@ def main():
5151 check_postgresql()
5252 parser = argparse.ArgumentParser()
5353 parser.add_argument('--debug', action='store_true', help='run Faraday Server in debug mode')
5555 parser.add_argument('--no-setup', action='store_true', help=argparse.SUPPRESS)
5656 parser.add_argument('--port', help='Overides server.ini port configuration')
5757 parser.add_argument('--websocket_port', help='Overides server.ini websocket port configuration')
58 @@ -131,8 +130,6 @@ def main():
58 @@ -133,8 +132,6 @@ def main():
5959 if result == 0:
6060 logger.error("Faraday Server port in use. Check your processes and run the server again...")
6161 sys.exit(1)
1414 1 file changed, 1 insertion(+), 1 deletion(-)
1515
1616 diff --git a/requirements.txt b/requirements.txt
17 index 1dc000b..188e641 100644
17 index 05bc27d..467e7cd 100644
1818 --- a/requirements.txt
1919 +++ b/requirements.txt
2020 @@ -25,7 +25,7 @@ tqdm>=4.15.0
2121 twisted>=18.9.0
22 webargs>=6.0.0
22 webargs>=7.0.0
2323 marshmallow-sqlalchemy
2424 -filteralchemy-fork
2525 +filteralchemy
1313 2 files changed, 4 insertions(+), 1 deletion(-)
1414
1515 diff --git a/faraday/manage.py b/faraday/manage.py
16 index 4a09639..6c13e13 100755
16 index ecde322..973dc59 100755
1717 --- a/faraday/manage.py
1818 +++ b/faraday/manage.py
1919 @@ -26,6 +26,9 @@ if platform.system() == "Linux":
2727 import requests
2828 import alembic.command
2929 diff --git a/requirements.txt b/requirements.txt
30 index 5ed0301..1dc000b 100644
30 index 93eeebe..05bc27d 100644
3131 --- a/requirements.txt
3232 +++ b/requirements.txt
3333 @@ -14,7 +14,7 @@ Flask-Security>=3.0.0