Commit fbc2ba4b authored by okhin's avatar okhin

100% coverage of campaign

parent b6ca30e7
...@@ -25,10 +25,7 @@ class CampaignAdmin(admin.ModelAdmin): ...@@ -25,10 +25,7 @@ class CampaignAdmin(admin.ModelAdmin):
return super(CampaignAdmin, self).formfield_for_foreignkey(db_field, return super(CampaignAdmin, self).formfield_for_foreignkey(db_field,
request, request,
**kwargs) **kwargs)
class CampaignContactAdmin(admin.ModelAdmin): class CampaignContactAdmin(admin.ModelAdmin):
def get_queryset(self, request): def get_queryset(self, request):
qs = super(CampaignContactAdmin, self).get_queryset(request) qs = super(CampaignContactAdmin, self).get_queryset(request)
if request.user.is_superuser: if request.user.is_superuser:
...@@ -38,7 +35,6 @@ class CampaignContactAdmin(admin.ModelAdmin): ...@@ -38,7 +35,6 @@ class CampaignContactAdmin(admin.ModelAdmin):
class ArgumentaryAdmin(admin.ModelAdmin): class ArgumentaryAdmin(admin.ModelAdmin):
def get_queryset(self, request): def get_queryset(self, request):
qs = super(ArgumentaryAdmin, self).get_queryset(request) qs = super(ArgumentaryAdmin, self).get_queryset(request)
if request.user.is_superuser: if request.user.is_superuser:
...@@ -54,8 +50,6 @@ class ArgumentaryAdmin(admin.ModelAdmin): ...@@ -54,8 +50,6 @@ class ArgumentaryAdmin(admin.ModelAdmin):
return super(ArgumentaryAdmin, self).formfield_for_foreignkey(db_field, return super(ArgumentaryAdmin, self).formfield_for_foreignkey(db_field,
request, request,
**kwargs) **kwargs)
admin.site.register(Campaign, CampaignAdmin) admin.site.register(Campaign, CampaignAdmin)
admin.site.register(CampaignContact, CampaignContactAdmin) admin.site.register(CampaignContact, CampaignContactAdmin)
admin.site.register(Argumentary, ArgumentaryAdmin) admin.site.register(Argumentary, ArgumentaryAdmin)
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import TestCase
from django.contrib.auth.models import User
from picampaign.campaign.models import Campaign, CampaignContact, Argumentary from picampaign.campaign.models import Campaign, CampaignContact, Argumentary
from picampaign.contact.models import Contact from picampaign.contact.models import Contact
from picampaign.campaign.admin import CampaignAdmin
class ArgumentaryMethodTests(TestCase): class ArgumentaryMethodTests(TestCase):
def test_str(self): def test_str(self):
......
...@@ -6,4 +6,3 @@ class ContactMethodsTest(TestCase): ...@@ -6,4 +6,3 @@ class ContactMethodsTest(TestCase):
def test_full_name(self): def test_full_name(self):
contact = Contact(first_name='Victor', last_name='Hugo') contact = Contact(first_name='Victor', last_name='Hugo')
self.assertEqual(contact.full_name(), 'Victor Hugo') self.assertEqual(contact.full_name(), 'Victor Hugo')
#!/bin/bash #!/bin/bash
${VIRTUAL_ENV}/bin/coverage run --source='.' manage.py test --parallel ${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',"*/test_*.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