Skip to content

Commit

Permalink
Changes made to pass the unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agl29 committed Feb 19, 2021
1 parent e989639 commit 46927fb
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 7 deletions.
5 changes: 4 additions & 1 deletion apps/beeswax/src/beeswax/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2910,7 +2910,10 @@ def test_save_design(self):

def test_get_history_xss(self):
sql = 'SELECT count(sample_07.salary) FROM sample_07;"><iFrAME>src="javascript:alert(\'Hue has an xss\');"></iFraME>'
sql_escaped = b'SELECT count(sample_07.salary) FROM sample_07;&quot;&gt;&lt;iFrAME&gt;src=&quot;javascript:alert(&#39;Hue has an xss&#39;);&quot;&gt;&lt;/iFraME&gt;'
if sys.version_info[0] < 3:
sql_escaped = b'SELECT count(sample_07.salary) FROM sample_07;&quot;&gt;&lt;iFrAME&gt;src=&quot;javascript:alert(&#39;Hue has an xss&#39;);&quot;&gt;&lt;/iFraME&gt;'
else:
sql_escaped = b'SELECT count(sample_07.salary) FROM sample_07;&quot;&gt;&lt;iFrAME&gt;src=&quot;javascript:alert(&#x27;Hue has an xss&#x27;);&quot;&gt;&lt;/iFraME&gt;'

response = _make_query(self.client, sql, submission_type='Save', name='My Name 1', desc='My Description')
content = json.loads(response.content)
Expand Down
6 changes: 5 additions & 1 deletion apps/jobbrowser/src/jobbrowser/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import json
import logging
import re
import sys
import time
import unittest

Expand Down Expand Up @@ -490,7 +491,10 @@ def test_acls_job(self):
assert_false(can_modify_job('test3', response.context[0]['job']))

response2 = self.c3.get('/jobbrowser/jobs/job_1356251510842_0054')
assert_true(b'don&#39;t have permission to access job' in response2.content, response2.content)
if sys.version_info[0] < 3:
assert_true(b'don&#39;t have permission to access job' in response2.content, response2.content)
else:
assert_true(b'don&#x27;t have permission to access job' in response2.content, response2.content)

def test_kill_job(self):
job_id = 'application_1356251510842_0054'
Expand Down
2 changes: 1 addition & 1 deletion apps/oozie/src/oozie/views/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def schedule_workflow(request, workflow):


@check_job_access_permission()
def create_coordinator(request, workflow=None):
def create_coordinator(request, workflow=None, *args, **kwargs):
if workflow is not None:
coordinator = Coordinator(owner=request.user, schema_version="uri:oozie:coordinator:0.2", coordinatorworkflow=workflow)
else:
Expand Down
10 changes: 8 additions & 2 deletions apps/useradmin/src/useradmin/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,7 +1111,10 @@ def test_edit_user_xss(self):
language="en-us><script>alert('Hacked')</script>"
)
)
assert_true(b'Select a valid choice. en-us&gt;&lt;script&gt;alert(&#39;Hacked&#39;)&lt;/script&gt; is not one of the available choices.' in response.content)
if sys.version_info[0] < 3:
assert_true(b'Select a valid choice. en-us&gt;&lt;script&gt;alert(&#39;Hacked&#39;)&lt;/script&gt; is not one of the available choices.' in response.content)
else:
assert_true(b'Select a valid choice. en-us&gt;&lt;script&gt;alert(&#x27;Hacked&#x27;)&lt;/script&gt; is not one of the available choices.' in response.content)
# Hue 4 Admin
response = edit_user.post('/useradmin/users/edit/admin', dict(
username="admin",
Expand All @@ -1133,7 +1136,10 @@ def test_edit_user_xss(self):
language="en-us><script>alert('Hacked')</script>"
)
)
assert_true(b'Select a valid choice. en-us&gt;&lt;script&gt;alert(&#39;Hacked&#39;)&lt;/script&gt; is not one of the available choices.' in response.content)
if sys.version_info[0] < 3:
assert_true(b'Select a valid choice. en-us&gt;&lt;script&gt;alert(&#39;Hacked&#39;)&lt;/script&gt; is not one of the available choices.' in response.content)
else:
assert_true(b'Select a valid choice. en-us&gt;&lt;script&gt;alert(&#x27;Hacked&#x27;)&lt;/script&gt; is not one of the available choices.' in response.content)
# Hue 4, User with access to useradmin app
response = edit_user.post('/useradmin/users/edit/edit_user', dict(
username="edit_user",
Expand Down
2 changes: 1 addition & 1 deletion desktop/core/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ channels==3.0.3
channels-redis==3.2.0
configobj==5.0.6
cryptography==3.3.2
django-auth-ldap==1.3.0
django-auth-ldap==2.3.0
Django==3.0.12
django-axes==5.13.0
django-celery-beat==1.4.0
Expand Down
2 changes: 1 addition & 1 deletion desktop/core/src/desktop/ldaptestcmd_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from django.core import management
from django.core.management import get_commands
from django.test import SimpleTestCase
from django.utils.six import StringIO
from six import StringIO

class CmdTests(SimpleTestCase):
def checkcmd(self):
Expand Down

0 comments on commit 46927fb

Please sign in to comment.