Esempio n. 1
0
class TestMeetingCreateFormView(AdminTestCase):
    def setUp(self):
        super(TestMeetingCreateFormView, self).setUp()
        Conference.remove()
        self.user = AuthUserFactory()
        self.request = RequestFactory().post('/fake_path')
        self.view = MeetingCreateFormView()
        mod_data = dict(data)
        mod_data.update({'admins': self.user.emails[0]})
        self.form = MeetingForm(data=mod_data)
        self.form.is_valid()

    def test_get_initial(self):
        self.view.get_initial()
        nt.assert_equal(self.view.initial['edit'], False)
        nt.assert_equal(self.view.initial['submission1'],
                        DEFAULT_FIELD_NAMES['submission1'])

    def test_form_valid(self):
        view = setup_form_view(self.view, self.request, self.form)
        view.form_valid(self.form)
        nt.assert_equal(
            Conference.find(Q('endpoint', 'iexact', data['endpoint'])).count(),
            1
        )
Esempio n. 2
0
 def setUp(self):
     super(TestMeetingCreateFormView, self).setUp()
     Conference.remove()
     self.user = AuthUserFactory()
     self.request = RequestFactory().post('/fake_path')
     self.view = MeetingCreateFormView()
     mod_data = dict(data)
     mod_data.update({'admins': self.user.emails[0]})
     self.form = MeetingForm(data=mod_data)
     self.form.is_valid()