def matchBuildID(ruleBuildID, queryBuildID): """Decides whether a buildID from the rules matches an incoming one. If the ruleBuildID is null, we match any queryBuildID. If it's not null, we must either match exactly, or match with a camparison operator.""" if ruleBuildID is None: return True return string_compare(queryBuildID, ruleBuildID)
def test_lesser_or_equal(self): self.assertTrue(string_compare('20150314092652', '<=20150314092653')) self.assertTrue(string_compare('20150314092653', '<=20150314092653')) self.assertFalse(string_compare('20150314092654', '<=20150314092653'))
def test_less_than(self): self.assertTrue(string_compare('20150314092652', '<20150314092653')) self.assertFalse(string_compare('20150314092653', '<20150314092653')) self.assertFalse(string_compare('20150314092654', '<20150314092653'))
def test_greater_than(self): self.assertFalse(string_compare('20150314092652', '>20150314092653')) self.assertFalse(string_compare('20150314092653', '>20150314092653')) self.assertTrue(string_compare('20150314092654', '>20150314092653'))
def test_equality(self): self.assertTrue(string_compare('20150314092653', '20150314092653')) self.assertFalse(string_compare('20010100000000', '20150314092653'))