コード例 #1
0
 def test_project_hours_for_contract_none(self):
     # Try it with the aggregate returning None
     ctx = {}
     retval = tags.project_hours_for_contract(ctx, self.contract,
         self.project_without_hours)
     self.assertEqual('', retval)
     self.assertEqual(0, ctx['project_hours'])
コード例 #2
0
 def test_project_hours_for_contract_varname(self):
     # Specify a variable name, that's where the hours should go
     ctx = {}
     retval = tags.project_hours_for_contract(ctx, self.contract,
         self.another_project, variable='foo_bar')
     self.assertEqual('', retval)
     self.assertNotIn('project_hours', ctx)
     self.assertEqual(2, ctx['foo_bar'])
コード例 #3
0
 def test_project_hours_for_contract_badbillable(self):
     # template tag does syntax check on the 'billable' arg
     with self.assertRaises(template.TemplateSyntaxError):
         tags.project_hours_for_contract(self.contract, self.a_project,
                                         'invalidarg')
コード例 #4
0
 def test_project_hours_for_contract_nonbillable(self):
     # only include non-billable hours
     retval = tags.project_hours_for_contract(self.contract,
                                              self.billable_project,
                                              'nonbillable')
     self.assertEqual(8, retval)
コード例 #5
0
 def test_project_hours_for_contract_none(self):
     # Try it with the aggregate returning None
     retval = tags.project_hours_for_contract(self.contract,
                                              self.project_without_hours)
     self.assertEqual(0, retval)
コード例 #6
0
 def test_project_hours_for_contract(self):
     retval = tags.project_hours_for_contract(self.contract, self.a_project)
     # Includes billable and nonbillable by default
     self.assertEqual(17, retval)
コード例 #7
0
 def test_project_hours_for_contract_badbillable(self):
     # template tag does syntax check on the 'billable' arg
     with self.assertRaises(template.TemplateSyntaxError):
         tags.project_hours_for_contract(
             self.contract, self.a_project, 'invalidarg')
コード例 #8
0
 def test_project_hours_for_contract_nonbillable(self):
     # only include non-billable hours
     retval = tags.project_hours_for_contract(
         self.contract, self.billable_project, 'nonbillable')
     self.assertEqual(8, retval)
コード例 #9
0
 def test_project_hours_for_contract(self):
     retval = tags.project_hours_for_contract(self.contract, self.a_project)
     # Includes billable and nonbillable by default
     self.assertEqual(17, retval)
コード例 #10
0
 def test_project_hours_for_contract(self):
     ctx = {}
     retval = tags.project_hours_for_contract(ctx, self.contract,
         self.a_project)
     self.assertEqual('', retval)
     self.assertEqual(1, ctx['project_hours'])