mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 10:30:03 -03:30
add tests that trigger error without fix provided
This commit is contained in:
parent
cea9dbdb4f
commit
df6b6e55a7
@ -1152,6 +1152,27 @@ class JobTemplateSurveyTest(BaseJobTestMixin, django.test.TestCase):
|
||||
job_extra = json.loads(job.extra_vars)
|
||||
self.assertTrue("favorite_color" in job_extra)
|
||||
|
||||
# launch job template with required survey without providing survey data
|
||||
with self.current_user(self.user_sue):
|
||||
self.post(url, json.loads(TEST_SIMPLE_REQUIRED_SURVEY), expect=200)
|
||||
response = self.get(launch_url)
|
||||
self.assertTrue('favorite_color' in response['variables_needed_to_start'])
|
||||
response = self.post(launch_url, dict(extra_vars=dict()), expect=400)
|
||||
# Note: The below assertion relies on how survey_variable_validation() crafts
|
||||
# the error message
|
||||
self.assertIn("'favorite_color' value missing", response['variables_needed_to_start'])
|
||||
|
||||
# launch job template with required survey without providing survey data and without
|
||||
# even providing extra_vars
|
||||
with self.current_user(self.user_sue):
|
||||
self.post(url, json.loads(TEST_SIMPLE_REQUIRED_SURVEY), expect=200)
|
||||
response = self.get(launch_url)
|
||||
self.assertTrue('favorite_color' in response['variables_needed_to_start'])
|
||||
response = self.post(launch_url, {}, expect=400)
|
||||
# Note: The below assertion relies on how survey_variable_validation() crafts
|
||||
# the error message
|
||||
self.assertIn("'favorite_color' value missing", response['variables_needed_to_start'])
|
||||
|
||||
with self.current_user(self.user_sue):
|
||||
response = self.post(url, json.loads(TEST_SIMPLE_NONREQUIRED_SURVEY), expect=200)
|
||||
response = self.get(launch_url)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user