Пример #1
0
 def test_create_project_form(self):
     form_data = {
         'name': 'Best Project Ever',
         'slug': 'srsly',
         'team': 1,
         'url': 'not a url',
     }
     form = CreateProjectForm(form_data)
     eq_(False, form.is_valid())
     ok_('url' in form.errors)
     form_data['url'] = GOOD_BZ_URL
     form = CreateProjectForm(form_data)
     eq_(True, form.is_valid())
     project = form.save()
     eq_(project.urls.count(), 1)
     eq_(project.urls.all()[0].url, GOOD_BZ_URL)
     # no url required
     form = CreateProjectForm({
         'name': 'FO REAL Best Ever',
         'slug': 'srsly-fo-real',
         'team': 1,
     })
     eq_(True, form.is_valid())
Пример #2
0
 def test_create_project_form(self):
     form_data = {
         'name': 'Best Project Ever',
         'slug': 'srsly',
         'team': 1,
         'product': 'Websites',
     }
     form = CreateProjectForm(form_data)
     eq_(False, form.is_valid())
     ok_('product' in form.errors)
     form_data['product'] = 'Websites/__ALL__'
     form = CreateProjectForm(form_data)
     eq_(True, form.is_valid())
     project = form.save()
     eq_(project.products.count(), 1)
     eq_(project.products.all()[0].name, 'Websites')
     eq_(project.products.all()[0].component, scrum_models.ALL_COMPONENTS)
     # no product required
     form = CreateProjectForm({
         'name': 'FO REAL Best Ever',
         'slug': 'srsly-fo-real',
         'team': 1,
     })
     eq_(True, form.is_valid())
Пример #3
0
 def test_create_project_form(self):
     form_data = {
         'name': 'Best Project Ever',
         'slug': 'srsly',
         'team': 1,
         'url': 'not a url',
     }
     form = CreateProjectForm(form_data)
     eq_(False, form.is_valid())
     ok_('url' in form.errors)
     form_data['url'] = GOOD_BZ_URL
     form = CreateProjectForm(form_data)
     eq_(True, form.is_valid())
     project = form.save()
     eq_(project.urls.count(), 1)
     eq_(project.urls.all()[0].url, GOOD_BZ_URL)
     # no url required
     form = CreateProjectForm({
         'name': 'FO REAL Best Ever',
         'slug': 'srsly-fo-real',
         'team': 1,
     })
     eq_(True, form.is_valid())
Пример #4
0
 def test_create_project_form(self):
     form_data = {
         'name': 'Best Project Ever',
         'slug': 'srsly',
         'team': 1,
         'product': 'Websites',
     }
     form = CreateProjectForm(form_data)
     eq_(False, form.is_valid())
     ok_('product' in form.errors)
     form_data['product'] = 'Websites/__ALL__'
     form = CreateProjectForm(form_data)
     eq_(True, form.is_valid())
     project = form.save()
     eq_(project.products.count(), 1)
     eq_(project.products.all()[0].name, 'Websites')
     eq_(project.products.all()[0].component, scrum_models.ALL_COMPONENTS)
     # no product required
     form = CreateProjectForm({
         'name': 'FO REAL Best Ever',
         'slug': 'srsly-fo-real',
         'team': 1,
     })
     eq_(True, form.is_valid())