Esempio n. 1
0
 def test_all_fields_renders(self):
     '''
     Check if all fields from context renders
     '''
     Contact.objects.all().delete()
     person = Contact()
     person.name = 'Oleksandr'
     person.last_name = 'Vinnichuk'
     person.date_of_birth = '1984-06-13'
     person.skype = "prof.zojdberg"
     person.jabber = "*****@*****.**"
     person.email = "*****@*****.**"
     person.other_contacts = "mobile +380664444032"
     person.bio = "Born in Kovel"
     person.save()
     response = self.client.get(reverse('home'))
     self.assertIn('Oleksandr', response.content)
     self.assertIn('Vinnichuk', response.content)
     self.assertIn('June 13, 1984', response.content)
     self.assertIn('prof.zojdberg', response.content)
     self.assertIn('*****@*****.**', response.content)
     self.assertIn('*****@*****.**', response.content)
     self.assertIn('*****@*****.**', response.content)
     self.assertIn('mobile +380664444032', response.content)
     self.assertIn('Born in Kovel', response.content)
Esempio n. 2
0
 def test_all_fields_renders(self):
     '''
     Check if all fields from context renders
     '''
     Contact.objects.all().delete()
     person = Contact()
     person.name = 'Oleksandr'
     person.last_name = 'Vinnichuk'
     person.date_of_birth = '1984-06-13'
     person.skype = "prof.zojdberg"
     person.jabber = "*****@*****.**"
     person.email = "*****@*****.**"
     person.other_contacts = "mobile +380664444032"
     person.bio = "Born in Kovel"
     person.save()
     response = self.client.get(reverse('home'))
     self.assertIn('Oleksandr', response.content)
     self.assertIn('Vinnichuk', response.content)
     self.assertIn('June 13, 1984', response.content)
     self.assertIn('prof.zojdberg', response.content)
     self.assertIn('*****@*****.**', response.content)
     self.assertIn('*****@*****.**', response.content)
     self.assertIn('*****@*****.**', response.content)
     self.assertIn('mobile +380664444032', response.content)
     self.assertIn('Born in Kovel', response.content)
Esempio n. 3
0
 def test_cyrillic_render(self):
     '''
     Check if cyrillic render
     '''
     Contact.objects.all().delete()
     person = Contact()
     person.name = u'Олександр'
     person.save()
     response = self.client.get(reverse('home'))
     self.assertIn('Олександр', response.content)
Esempio n. 4
0
 def test_cyrillic_render(self):
     '''
     Check if cyrillic render
     '''
     Contact.objects.all().delete()
     person = Contact()
     person.name = u'Олександр'
     person.save()
     response = self.client.get(reverse('home'))
     self.assertIn('Олександр', response.content)
Esempio n. 5
0
    def test_context(self):
        '''
        Check if right data is in context
        '''

        Contact.objects.all().delete()
        person = Contact()
        person.name = 'Oleksandr'
        person.save()
        response = self.client.get(reverse('home'))
        home_context = response.context['info']
        self.assertEqual(home_context, person)
Esempio n. 6
0
    def test_context(self):
        '''
        Check if right data is in context
        '''

        Contact.objects.all().delete()
        person = Contact()
        person.name = 'Oleksandr'
        person.save()
        response = self.client.get(reverse('home'))
        home_context = response.context['info']
        self.assertEqual(home_context, person)
Esempio n. 7
0
 def test_multiple_db_instances(self):
     '''
     Check if db has more then one instances, the first one is
     rendered
     '''
     Contact.objects.all().delete()
     person1 = Contact()
     person1.name = "Pablo"
     person1.save()
     person2 = Contact()
     person2.name = "Juan"
     person2.save()
     response = self.client.get(reverse('home'))
     home_context = response.context['info']
     self.assertEqual(home_context, person1)
Esempio n. 8
0
 def test_multiple_db_instances(self):
     '''
     Check if db has more then one instances, the first one is
     rendered
     '''
     Contact.objects.all().delete()
     person1 = Contact()
     person1.name = "Pablo"
     person1.save()
     person2 = Contact()
     person2.name = "Juan"
     person2.save()
     response = self.client.get(reverse('home'))
     home_context = response.context['info']
     self.assertEqual(home_context, person1)
Esempio n. 9
0
    def test_saving_fields(self):
        '''
         Check model can save data
        '''
        person = Contact()
        person.name = 'Petro'
        person.last_name = 'Shchur'
        person.save()

        # check our model saves data
        saved_persons = Contact.objects.all()
        self.assertEqual(saved_persons.count(), 2)
        person_from_fixtures = saved_persons[0]
        saved_person = saved_persons[1]
        self.assertEqual(saved_person.name, 'Petro')
        self.assertEqual(saved_person.last_name, 'Shchur')
        self.assertEqual(person_from_fixtures.name, 'Oleksandr')
        self.assertEqual(person_from_fixtures.last_name, 'Vinnichuk')
Esempio n. 10
0
    def test_saving_fields(self):
        '''
         Check model can save data
        '''
        person = Contact()
        person.name = 'Petro'
        person.last_name = 'Shchur'
        person.save()

        # check our model saves data
        saved_persons = Contact.objects.all()
        self.assertEqual(saved_persons.count(), 2)
        person_from_fixtures = saved_persons[0]
        saved_person = saved_persons[1]
        self.assertEqual(saved_person.name, 'Petro')
        self.assertEqual(saved_person.last_name, 'Shchur')
        self.assertEqual(person_from_fixtures.name, 'Oleksandr')
        self.assertEqual(person_from_fixtures.last_name, 'Vinnichuk')