Пример #1
0
 def test_survey_password_hide(self, mocker):
     job = mocker.MagicMock(**{
         'display_extra_vars.return_value': '{\"secret_key\": \"$encrypted$\"}',
         'extra_vars.return_value': '{\"secret_key\": \"my_password\"}'})
     serializer = JobSerializer(job)
     rep = serializer.to_representation(job)
     extra_vars = json.loads(rep['extra_vars'])
     assert extra_vars['secret_key'] == '$encrypted$'
     job.display_extra_vars.assert_called_once_with()
     assert 'my_password' not in extra_vars
Пример #2
0
 def test_job_template_absent(self, job):
     job.job_template = None
     serializer = JobSerializer()
     related = serializer.get_related(job)
     assert 'job_template' not in related