~ubuntu-branches/ubuntu/trusty/horizon/trusty-updates

« back to all changes in this revision

Viewing changes to openstack_dashboard/dashboards/project/stacks/tests.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-12-05 14:39:15 UTC
  • mfrom: (1.1.35)
  • Revision ID: package-import@ubuntu.com-20131205143915-40991ba69inywk0u
Tags: 1:2014.1~b1-0ubuntu1
* New upstream release.
* debian/control: open icehouse release.
* debian/static/openstack-dashboard: Refreshed static assets.

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
        res = self.client.post(url, form_data)
156
156
        self.assertRedirectsNoFollow(res, INDEX_URL)
157
157
 
 
158
    def test_launch_stack_form_invalid_names_fail(self):
 
159
        self._test_launch_stack_invalid_name('2_StartWithDigit')
 
160
        self._test_launch_stack_invalid_name('_StartWithUnderscore')
 
161
        self._test_launch_stack_invalid_name('.StartWithPoint')
 
162
 
 
163
    def _test_launch_stack_invalid_name(self, name):
 
164
        template = self.stack_templates.first()
 
165
        url = reverse('horizon:project:stacks:launch')
 
166
        form_data = {'template_source': 'raw',
 
167
                     'template_data': template.data,
 
168
                     'password': 'password',
 
169
                     'parameters': template.validate,
 
170
                     'stack_name': name,
 
171
                     "timeout_mins": 60,
 
172
                     "disable_rollback": True,
 
173
                     "__param_DBUsername": "admin",
 
174
                     "__param_LinuxDistribution": "F17",
 
175
                     "__param_InstanceType": "m1.small",
 
176
                     "__param_KeyName": "test",
 
177
                     "__param_DBPassword": "admin",
 
178
                     "__param_DBRootPassword": "admin",
 
179
                     "__param_DBName": "wordpress",
 
180
                     'method': forms.StackCreateForm.__name__}
 
181
 
 
182
        res = self.client.post(url, form_data)
 
183
        error = ('Name must start with a letter and may only contain letters, '
 
184
                 'numbers, underscores, periods and hyphens.')
 
185
 
 
186
        self.assertFormErrors(res, 1)
 
187
        self.assertFormError(res, "form", 'stack_name', error)
 
188
 
158
189
 
159
190
class TemplateFormTests(test.TestCase):
160
191