def test_create_account_project(self, create):
     """Test that execution is deferred to the create_pcpp method"""
     row = {'PROJ_NAME1': 'Some Proj', 'PROJ_NO': '121-212', 'SECTOR': 'IT'}
     sync.create_account(row, None)
     self.assertTrue(create.called)
     account, row, issue_map = create.call_args[0]
     self.assertEqual(account.name, 'Some Proj')
     self.assertEqual(account.code, '121-212')
     self.assertEqual(account.category, Account.PROJECT)
     self.assertEqual(0, len(Account.objects.filter(pk=account.pk)))
 def test_create_account_sector(self):
     """The creation of sectors creates a sector map, too"""
     row = {'PROJ_NAME1': 'Renewal Fund', 'PROJ_NO': 'SPF-REN',
            'LOCATION': 'D/OSP/GGM', 'SUMMARY': 'Some Sum',
            'SECTOR': 'RENEW'}
     sync.create_account(row, None)
     account = Account.objects.get(code='SPF-REN')
     campaign = Campaign.objects.get(account=account)
     mapping = SectorMapping.objects.get(pk='RENEW')
     self.assertEqual(mapping.campaign, campaign)
     account.delete()    # cascades
 def test_create_account_project(self, create):
     """Test that execution is deferred to the create_pcpp method"""
     row = {'PROJ_NAME1': 'Some Proj', 'PROJ_NO': '121-212',
            'SECTOR': 'IT'}
     sync.create_account(row, None)
     self.assertTrue(create.called)
     account, row, issue_map = create.call_args[0]
     self.assertEqual(account.name, 'Some Proj')
     self.assertEqual(account.code, '121-212')
     self.assertEqual(account.category, Account.PROJECT)
     self.assertEqual(0, len(Account.objects.filter(pk=account.pk)))
예제 #4
0
 def test_create_account_sector(self):
     """The creation of sectors creates a sector map, too"""
     row = {'PROJ_NAME1': 'Renewal Fund', 'PROJ_NO': 'SPF-REN',
            'LOCATION': 'D/OSP/GGM', 'SUMMARY': 'Some Sum',
            'SECTOR': 'RENEW'}
     sync.create_account(row, None)
     account = Account.objects.get(code='SPF-REN')
     campaign = Campaign.objects.get(account=account)
     mapping = SectorMapping.objects.get(pk='RENEW')
     self.assertEqual(mapping.campaign, campaign)
     account.delete()    # cascades
 def test_create_account_campaign(self, create):
     """Test that execution is deferred to the create_campaign method"""
     """Campaigns should be created"""
     row = {'PROJ_NAME1': 'Argentina Fund', 'PROJ_NO': '789-CFD',
            'SUMMARY': 'Some Sum'}
     sync.create_account(row, None)
     self.assertTrue(create.called)
     account, row, name, acc_type = create.call_args[0]
     self.assertEqual(account.name, 'Argentina Fund')
     self.assertEqual(account.code, '789-CFD')
     self.assertEqual(account.category, Account.COUNTRY)
     self.assertEqual(0, len(Account.objects.filter(pk=account.pk)))
예제 #6
0
 def test_create_account_campaign(self, create):
     """Test that execution is deferred to the create_campaign method"""
     """Campaigns should be created"""
     row = {'PROJ_NAME1': 'Argentina Fund', 'PROJ_NO': '789-CFD',
            'SUMMARY': 'Some Sum'}
     sync.create_account(row, None)
     self.assertTrue(create.called)
     account, row, name, acc_type = create.call_args[0]
     self.assertEqual(account.name, 'Argentina Fund')
     self.assertEqual(account.code, '789-CFD')
     self.assertEqual(account.category, Account.COUNTRY)
     self.assertEqual(0, len(Account.objects.filter(pk=account.pk)))
 def test_create_account_double(self, Campaign):
     """If an account with the same name already exists, create a distinct
     name based on project code"""
     row = {'PROJ_NAME1': 'China Fund', 'PROJ_NO': '777-CFD',
            'SUMMARY': 'Some Sum', 'LOCATION': 'CHINA'}
     sync.create_account(row, None)
     row['PROJ_NO'] = '778-CFD'
     sync.create_account(row, None)
     account = Account.objects.get(code='777-CFD')
     self.assertEqual(account.name, 'China Fund')
     account.delete()
     account = Account.objects.get(code='778-CFD')
     self.assertEqual(account.name, 'China Fund (778-CFD)')
     account.delete()
예제 #8
0
 def test_create_account_double(self, Campaign):
     """If an account with the same name already exists, create a distinct
     name based on project code"""
     row = {'PROJ_NAME1': 'China Fund', 'PROJ_NO': '777-CFD',
            'SUMMARY': 'Some Sum', 'LOCATION': 'CHINA'}
     sync.create_account(row, None)
     row['PROJ_NO'] = '778-CFD'
     sync.create_account(row, None)
     account = Account.objects.get(code='777-CFD')
     self.assertEqual(account.name, 'China Fund')
     account.delete()
     account = Account.objects.get(code='778-CFD')
     self.assertEqual(account.name, 'China Fund (778-CFD)')
     account.delete()