clean up unwanted data in activity stream of nodes

This commit is contained in:
AlanCoding
2018-11-28 10:23:09 -05:00
parent 87b55dc413
commit 1adeb833fb
3 changed files with 18 additions and 1 deletions

View File

@@ -236,3 +236,17 @@ def test_survey_create_diff(job_template, survey_spec_factory):
before, after = model_instance_diff(old, job_template, model_serializer_mapping)['survey_spec']
assert before == '{}'
assert json.loads(after) == survey_spec_factory('foo')
@pytest.mark.django_db
def test_saved_passwords_hidden_activity(workflow_job_template, job_template_with_survey_passwords):
node_with_passwords = workflow_job_template.workflow_nodes.create(
unified_job_template=job_template_with_survey_passwords,
extra_data={'bbbb': '$encrypted$fooooo'},
survey_passwords={'bbbb': '$encrypted$'}
)
node_with_passwords.delete()
entry = ActivityStream.objects.order_by('timestamp').last()
changes = json.loads(entry.changes)
assert 'survey_passwords' not in changes
assert json.loads(changes['extra_data'])['bbbb'] == '$encrypted$'