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'])
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'])
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')
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)
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)
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)
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')
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)
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'])