Commit b6ca30e7 authored by okhin's avatar okhin

Coverage 100% on picampaign/campaign/models.py

parent 2c4d9d5e
from django.conf import settings
from django.test import TestCase
from picampaign.campaign.models import Campaign, CampaignContact
from picampaign.campaign.models import Campaign, CampaignContact, Argumentary
from picampaign.contact.models import Contact
class CampaignContactMethodTests(TestCase):
def test_all_groups_is_empty(self):
class ArgumentaryMethodTests(TestCase):
def test_str(self):
campaign = Campaign(
title='Campaign Title',
start_date='2000-01-01',
end_date='2100-12-31'
)
argumentary = Argumentary(
campaign=campaign,
lang='fr',
text='Argument number 1'
)
self.assertEqual(str(argumentary), 'Argumentary in fr for Campaign Title')
class CampaignMethodTests(TestCase):
def test_str(self):
campaign = Campaign(
title='Campaign Title',
start_date='2000-01-01',
end_date='2100-12-31'
)
contact = Contact.objects.create(
self.assertEqual(str(campaign), campaign.title)
class CampaignContactMethodTests(TestCase):
def setUp(self):
self.campaign = Campaign(
title='Campaign Title',
start_date='2000-01-01',
end_date='2100-12-31'
)
self.contact = Contact.objects.create(
first_name='Victor',
last_name='Hugo',
birthdate='1802-02-26',
)
campaigncontact = CampaignContact(
campaign=campaign,
contact=contact
self.campaigncontact = CampaignContact(
campaign=self.campaign,
contact=self.contact
)
self.assertEqual(campaigncontact.all_groups(),[])
def test_all_groups_is_empty(self):
self.assertEqual(self.campaigncontact.all_groups(),[])
def test_str(self):
self.assertEqual(str(self.campaigncontact), 'Contact %(contact)s on %(title)s' % {'contact': self.contact, 'title': self.campaign.title})
#!/bin/bash
${VIRTUAL_ENV}/bin/coverage run --source='.' manage.py test
${VIRTUAL_ENV}/bin/coverage run --source='.' manage.py test --parallel
${VIRTUAL_ENV}/bin/coverage report --omit="${VIRTUAL_ENV}/*",'*__init__.py'
${VIRTUAL_ENV}/bin/coverage report -m --skip-covered --omit="${VIRTUAL_ENV}/*","*__init__.py"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment