mirror of
https://github.com/ansible/awx.git
synced 2026-03-02 09:18:48 -03:30
Merge pull request #79 from chrismeyersfsu/feature-survey_password_redact
Feature survey password redact
This commit is contained in:
@@ -5,7 +5,6 @@
|
|||||||
import hmac
|
import hmac
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import re
|
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|||||||
@@ -14,4 +14,3 @@ from awx.main.tests.activity_stream import * # noqa
|
|||||||
from awx.main.tests.schedules import * # noqa
|
from awx.main.tests.schedules import * # noqa
|
||||||
from awx.main.tests.redact import * # noqa
|
from awx.main.tests.redact import * # noqa
|
||||||
from awx.main.tests.views import * # noqa
|
from awx.main.tests.views import * # noqa
|
||||||
from awx.main.tests.jobs import *
|
|
||||||
|
|||||||
@@ -323,8 +323,8 @@ class BaseTestMixin(QueueTestMixin):
|
|||||||
job_template = self.make_job_template(created_by=created_by)
|
job_template = self.make_job_template(created_by=created_by)
|
||||||
|
|
||||||
opts = {
|
opts = {
|
||||||
'created_by': created_by,
|
'created_by': created_by,
|
||||||
'status': inital_state,
|
'status': inital_state,
|
||||||
}
|
}
|
||||||
opts.update(kwargs)
|
opts.update(kwargs)
|
||||||
return job_template.create_job(**opts)
|
return job_template.create_job(**opts)
|
||||||
@@ -448,9 +448,13 @@ class BaseTestMixin(QueueTestMixin):
|
|||||||
elif response['Content-Type'].startswith('application/yaml'):
|
elif response['Content-Type'].startswith('application/yaml'):
|
||||||
obj = yaml.safe_load(response.content)
|
obj = yaml.safe_load(response.content)
|
||||||
elif response['Content-Type'].startswith('text/plain'):
|
elif response['Content-Type'].startswith('text/plain'):
|
||||||
obj = { 'content': response.content }
|
obj = {
|
||||||
|
'content': response.content
|
||||||
|
}
|
||||||
elif response['Content-Type'].startswith('text/html'):
|
elif response['Content-Type'].startswith('text/html'):
|
||||||
obj = { 'content': response.content }
|
obj = {
|
||||||
|
'content': response.content
|
||||||
|
}
|
||||||
else:
|
else:
|
||||||
self.fail('Unsupport response content type %s' % response['Content-Type'])
|
self.fail('Unsupport response content type %s' % response['Content-Type'])
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
from jobs_monolithic import *
|
from awx.main.tests.jobs.jobs_monolithic import * # noqa
|
||||||
from survey_password import *
|
from survey_password import * # noqa
|
||||||
from base import *
|
from base import * # noqa
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
import django.test
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
||||||
# AWX
|
# AWX
|
||||||
@@ -91,32 +90,32 @@ TEST_SINGLE_PASSWORDS = [
|
|||||||
{
|
{
|
||||||
'description': 'Single instance with a . after',
|
'description': 'Single instance with a . after',
|
||||||
'text' : 'See spot. See spot run. See spot run %s. That is a fast run.' % PASSWORD,
|
'text' : 'See spot. See spot run. See spot run %s. That is a fast run.' % PASSWORD,
|
||||||
'passwords': [ PASSWORD ],
|
'passwords': [PASSWORD],
|
||||||
'occurances': 1,
|
'occurances': 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'description': 'Single instance with , after',
|
'description': 'Single instance with , after',
|
||||||
'text': 'Spot goes %s, at a fast pace' % PASSWORD,
|
'text': 'Spot goes %s, at a fast pace' % PASSWORD,
|
||||||
'passwords': [ PASSWORD ],
|
'passwords': [PASSWORD],
|
||||||
'occurances': 1,
|
'occurances': 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'description': 'Single instance with a space after',
|
'description': 'Single instance with a space after',
|
||||||
'text': 'Is %s very fast?' % PASSWORD,
|
'text': 'Is %s very fast?' % PASSWORD,
|
||||||
'passwords': [ PASSWORD ],
|
'passwords': [PASSWORD],
|
||||||
'occurances': 1,
|
'occurances': 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'description': 'Many instances, also with newline',
|
'description': 'Many instances, also with newline',
|
||||||
'text': 'I think %s is very very fast. If I ran %s for 4 hours how many hours would I run?.\nTrick question. %s for 4 hours would result in running for 4 hours' % (PASSWORD, PASSWORD, PASSWORD),
|
'text': 'I think %s is very very fast. If I ran %s for 4 hours how many hours would I run?.\nTrick question. %s for 4 hours would result in running for 4 hours' % (PASSWORD, PASSWORD, PASSWORD),
|
||||||
'passwords': [ PASSWORD ],
|
'passwords': [PASSWORD],
|
||||||
'occurances': 3,
|
'occurances': 3,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
passwd = 'my!@#$%^pass&*()_+'
|
passwd = 'my!@#$%^pass&*()_+'
|
||||||
TEST_SINGLE_PASSWORDS.append({
|
TEST_SINGLE_PASSWORDS.append({
|
||||||
'description': 'password includes characters not in a-z 0-9 range',
|
'description': 'password includes characters not in a-z 0-9 range',
|
||||||
'passwords': [ passwd ],
|
'passwords': [passwd],
|
||||||
'text': 'Text is fun yeah with passwords %s.' % passwd,
|
'text': 'Text is fun yeah with passwords %s.' % passwd,
|
||||||
'occurances': 1
|
'occurances': 1
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import unittest
|
|||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.test.utils import override_settings
|
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
|
|
||||||
# Django-CRUM
|
# Django-CRUM
|
||||||
|
|||||||
@@ -75,4 +75,4 @@ class UnifiedJobStdoutRedactedTests(BaseLiveServerTest, QueueStartStopTestMixin)
|
|||||||
self._test_redaction_enabled('html')
|
self._test_redaction_enabled('html')
|
||||||
|
|
||||||
def test_redaction_enabled_txt(self):
|
def test_redaction_enabled_txt(self):
|
||||||
self._test_redaction_enabled('txt')
|
self._test_redaction_enabled('txt')
|
||||||
|
|||||||
2
setup.cfg
Normal file → Executable file
2
setup.cfg
Normal file → Executable file
@@ -18,4 +18,4 @@ exclude=awx/lib/site-packages,awx/ui,awx/api/urls.py,awx/main/migrations,awx/mai
|
|||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore=E201,E203,E221,E225,E231,E241,E251,E261,E265,E302,E303,E501,W291,W391,W293,E731
|
ignore=E201,E203,E221,E225,E231,E241,E251,E261,E265,E302,E303,E501,W291,W391,W293,E731
|
||||||
exclude=awx/lib/site-packages,awx/ui,awx/api/urls.py,awx/main/migrations,awx/main/tests/data
|
exclude=awx/lib/site-packages,awx/ui,awx/api/urls.py,awx/main/migrations,awx/main/tests/data,node_modules/,awx/projects/
|
||||||
|
|||||||
Reference in New Issue
Block a user