Beispiel #1
0
 def test_phone_too_long_triggers_validation_error(self):
     data = self._get_data()
     data[
         'phone'] = '+55 81 982459204'  # Real data entered by brazilian user!
     form = CallForProposalForm(data)
     self.assertFalse(form.is_valid())
     self.assertIn('phone', form.errors)
Beispiel #2
0
    def test_form_save_models(self):
        form = CallForProposalForm(self._get_data())
        self.assertTrue(form.is_valid())

        speaker, proposal = form.save_to_models()
        self.assertEqual(speaker.name, "Daniel Pyrathon")
        self.assertEqual(proposal.speaker, speaker)
        self.assertEqual(speaker.user.username, "*****@*****.**")
Beispiel #3
0
    def test_form_save_models(self):
        form = CallForProposalForm(self._get_data())
        self.assertTrue(form.is_valid())

        speaker, proposal = form.save_to_models()
        self.assertEqual(speaker.name, "Daniel Pyrathon")
        self.assertEqual(proposal.speaker, speaker)
        self.assertEqual(proposal.speaker_and_talk_history, 'wooo2')
        self.assertEqual(proposal.talk_links, 'http://google.com')
        self.assertEqual(speaker.user.username, "*****@*****.**")
Beispiel #4
0
    def test_cannot_ommit_fields(self):
        all_fields = set(self._get_data().keys())
        all_fields.remove('website')

        for field_name in all_fields:
            data = self._get_data()
            del data[field_name]

            form = CallForProposalForm(data)
            self.assertFalse(form.is_valid())
            self.assertIn(field_name, form.errors)
Beispiel #5
0
    def test_form_save_models(self):
        form = CallForProposalForm(self._get_data())
        self.assertTrue(form.is_valid())

        speaker, proposal = form.save_to_models()
        self.assertEqual(speaker.name, "Daniel Pyrathon")
        self.assertEqual(proposal.speaker, speaker)
        self.assertEqual(proposal.speaker_and_talk_history, 'wooo2')
        self.assertEqual(proposal.talk_links, 'http://google.com')
        self.assertEqual(speaker.user.username, "*****@*****.**")
        self.assertEqual(
            'python fundamentals & popular libraries,engineering a community',
            proposal.themes)
Beispiel #6
0
    def test_form_duplicate_profile(self):
        form1 = CallForProposalForm(self._get_data())
        speaker1, proposal1 = form1.save_to_models()

        data = self._get_data()
        data['talk_title'] = 'woo 2!'
        form2 = CallForProposalForm(data)
        speaker2, proposal2 = form2.save_to_models()

        self.assertEqual(speaker1, speaker2)
Beispiel #7
0
 def test_cfp_form_works(self):
     form = CallForProposalForm(self._get_data())
     self.assertTrue(form.is_valid())
     self.assertEqual(len(form.cleaned_data), 13)