Beispiel #1
0
class ContactModelTest(TestCase):
    def setUp(self):
        self.speaker = Speaker(name='Jeferson Calazans',
                                slug='jeferson-calazans',
                                url='http://about.me/calazans10',
                                description='Passionate software developer!')
        self.speaker.save()

    def test_email(self):
        contact = Contact.objects.create(speaker=self.speaker, kind='E',
            value='*****@*****.**')
        self.assertEqual(1, contact.pk)

    def test_phone(self):
        contact = Contact.objects.create(speaker=self.speaker, kind='P',
            value='21-99995555')
        self.assertEqual(1, contact.pk)

    def test_fax(self):
        contact = Contact.objects.create(speaker=self.speaker, kind='F',
            value='21-66665555')
        self.assertEqual(1, contact.pk)

    def test_kind(self):
        'Contact kind should be limited to E, P or F.'
        contact = Contact(speaker=self.speaker, kind='A', value='B')
        self.assertRaises(ValidationError, contact.full_clean)

    def test_unicode(self):
        'Contact string representation should be value'
        contact = Contact(speaker=self.speaker, kind='E',
            value='*****@*****.**')
        self.assertEqual(u'*****@*****.**', unicode(contact))
Beispiel #2
0
class SpeakerModelTest(TestCase):
    def setUp(self):
        self.speaker = Speaker(name='Jeferson Calazans',
                                slug='jeferson-calazans',
                                url='http://about.me/calazans10',
                                description='Passionate software developer!')
        self.speaker.save()

    def test_create(self):
        'Speaker instance should be saved'
        self.assertEqual(1, self.speaker.pk)

    def test_unicode(self):
        'Speaker string representation should be the name.'
        self.assertEqual(u'Jeferson Calazans', unicode(self.speaker))
Beispiel #3
0
class SpeakerModelTest(TestCase):

    def setUp(self):
        self.speaker = Speaker(name='Rafael Alemar',
                               slug='rafael-alemar',
                               url='https://plus.google.com/u/0/108549132187205263216/posts',
                               description='Passionate software developer')
        self.speaker.save()

    def test_create(self):
        'Speaker instance should be saved'
        self.assertEqual(1, self.speaker.pk)

    def test_unicode(self):
        'Speaker string representation should be the name'
        self.assertEqual(u'Rafael Alemar', unicode(self.speaker))
Beispiel #4
0
class SpeakerModelTest(TestCase):
    def setUp(self):
        self.speaker = Speaker(
            name='Test Testing',
            slug='test-testing',
            url='http://testing.test.com',
            description='Passionate testing developer!'
        )
        self.speaker.save()

    def test_create(self):
        'Speaker instance should be saved'
        self.assertEqual(1, self.speaker.pk)

    def test_unicode(self):
        'Speaker string representation should be the name'
        self.assertEqual('Test Testing', unicode(self.speaker))
Beispiel #5
0
class SpeakerModelTest(TestCase):
    def setUp(self):
        self.speaker = Speaker(
                name='Leonardo Rezende',
                slug = 'leonardo-rezende',
                url = 'http://lrezende.eti.br',
                description = 'Desenvolvedor de software'
            )
        self.speaker.save()

    def test_create(self):
        '''
        Speaker instance should be saved
        '''
        self.assertEqual(1, self.speaker.pk)

    def test_unicode(self):
        '''
        Speaker string representation should be the name
        '''
        self.assertEqual(u'Leonardo Rezende', unicode(self.speaker))