def testMakeFieldAmendment_SingleValued(self): config = tracker_bizobj.MakeDefaultProjectIssueConfig(789) fd = tracker_pb2.FieldDef(field_id=1, field_name='Size') config.field_defs.append(fd) self.assertEqual( tracker_bizobj.MakeAmendment( tracker_pb2.FieldID.CUSTOM, 'Large', [], [], 'Size'), tracker_bizobj.MakeFieldAmendment(1, config, ['Large'], ['Small'])) self.assertEqual( tracker_bizobj.MakeAmendment( tracker_pb2.FieldID.CUSTOM, '----', [], [], 'Size'), tracker_bizobj.MakeFieldAmendment(1, config, [], ['Small']))
def testMakeFieldAmendment_MultiValued(self): config = tracker_bizobj.MakeDefaultProjectIssueConfig(789) fd = tracker_pb2.FieldDef( field_id=1, field_name='Days', is_multivalued=True) config.field_defs.append(fd) self.assertEqual( tracker_bizobj.MakeAmendment( tracker_pb2.FieldID.CUSTOM, '-Mon Tue Wed', [], [], 'Days'), tracker_bizobj.MakeFieldAmendment(1, config, ['Tue', 'Wed'], ['Mon'])) self.assertEqual( tracker_bizobj.MakeAmendment( tracker_pb2.FieldID.CUSTOM, '-Mon', [], [], 'Days'), tracker_bizobj.MakeFieldAmendment(1, config, [], ['Mon']))
def testMakeFieldClearedAmendment_Normal(self): config = tracker_bizobj.MakeDefaultProjectIssueConfig(789) fd = tracker_pb2.FieldDef(field_id=1, field_name='Rabbit') config.field_defs.append(fd) self.assertEqual( tracker_bizobj.MakeAmendment( tracker_pb2.FieldID.CUSTOM, '----', [], [], 'Rabbit'), tracker_bizobj.MakeFieldClearedAmendment(1, config))
def testMakeComponentsAmendment_Normal(self): config = tracker_bizobj.MakeDefaultProjectIssueConfig(789) config.component_defs = [ tracker_pb2.ComponentDef(component_id=1, path='UI'), tracker_pb2.ComponentDef(component_id=2, path='DB')] self.assertEqual( tracker_bizobj.MakeAmendment( tracker_pb2.FieldID.COMPONENTS, '-UI DB', [], []), tracker_bizobj.MakeComponentsAmendment([2], [1], config))
def testMakeFieldAmendment_SingleValuedUser(self): config = tracker_bizobj.MakeDefaultProjectIssueConfig(789) fd = tracker_pb2.FieldDef( field_id=1, field_name='Friend', field_type=tracker_pb2.FieldTypes.USER_TYPE) config.field_defs.append(fd) self.assertEqual( tracker_bizobj.MakeAmendment( tracker_pb2.FieldID.CUSTOM, '', [111L], [], 'Friend'), tracker_bizobj.MakeFieldAmendment(1, config, [111L], [222L])) self.assertEqual( tracker_bizobj.MakeAmendment( tracker_pb2.FieldID.CUSTOM, '', [], [], 'Friend'), tracker_bizobj.MakeFieldAmendment(1, config, [], [222L]))
def testMakeProjectAmendment(self): self.assertEqual( tracker_bizobj.MakeAmendment( tracker_pb2.FieldID.PROJECT, 'moonshot', [], []), tracker_bizobj.MakeProjectAmendment('moonshot'))
def testGetAmendmentFieldName_Builtin(self): amendment = tracker_bizobj.MakeAmendment( tracker_pb2.FieldID.SUMMARY, 'It broke', [], []) self.assertEqual('Summary', tracker_bizobj.GetAmendmentFieldName(amendment))