import unittest

from django.test import TestCase

from candidates.tests.test_create_person import mock_create_person

from .models import CachedCount

class CachedCountTechCase(TestCase):
    def setUp(self):
        initial_counts = (
            {
                'count_type': 'constituency',
                'name': 'Dulwich and West Norwood',
                'count': 10,
                'object_id': '65808'
            },
            {
                'count_type': 'party',
                'name': 'Labour',
                'count': 0,
                'object_id': 'party:53'
            },
        )
        for count in initial_counts:
            CachedCount(**count).save()

    def test_object_urls(self):
        for count in CachedCount.objects.filter(count_type='constituency'):
            self.assertTrue(count.object_url)

    def test_increment_count(self):
        self.assertEqual(CachedCount.objects.get(object_id='party:53').count, 0)
        self.assertEqual(CachedCount.objects.get(object_id='65808').count, 10)
        mock_create_person()
        self.assertEqual(CachedCount.objects.get(object_id='65808').count, 11)
        self.assertEqual(CachedCount.objects.get(object_id='party:53').count, 1)

@@ -149,74 +149,49 @@
 nt%0A%0A
-class CachedCountTechCase(TestCase):%0A    def setUp(self
+def create_initial_counts(extra=()
 ):%0A    
-  
-  
 init
@@ -209,32 +209,26 @@
 = (%0A        
-    %7B%0A  
+%7B%0A
             
@@ -219,34 +219,32 @@
   %7B%0A            
-  
 'count_type': 'c
@@ -253,28 +253,24 @@
 stituency',%0A
-    
             
@@ -309,36 +309,32 @@
 d',%0A            
-  
-  
 'count': 10,%0A   
@@ -330,20 +330,16 @@
 t': 10,%0A
-    
         
@@ -363,36 +363,32 @@
 '65808'%0A        
-    
 %7D,%0A            %7B
@@ -378,28 +378,24 @@
  %7D,%0A        
-    
 %7B%0A          
@@ -388,36 +388,32 @@
   %7B%0A            
- 
-   
 'count_type': 'p
@@ -423,36 +423,32 @@
 y',%0A            
-    
 'name': 'Labour'
@@ -453,36 +453,32 @@
 r',%0A            
- 
-   
 'count': 0,%0A    
@@ -473,20 +473,16 @@
 nt': 0,%0A
-    
         
@@ -521,29 +521,62 @@
     
- 
-   
 %7D,%0A    
+)%0A
     
-)%0A    
+initial_counts = initial_counts + extra%0A%0A
     
@@ -612,20 +612,16 @@
         
-  
-  
 CachedCo
@@ -641,16 +641,107 @@
 save()%0A%0A
+class CachedCountTechCase(TestCase):%0A    def setUp(self):%0A        create_initial_counts()%0A%0A
     def 

Create initial counts outside the test class