def test_from_flag(self): Endpoint._endpoints['foo'] = endpoint = Endpoint('foo') self.assertIsNone(Endpoint.from_flag('foo')) self.assertIsNone(Endpoint.from_flag('bar.qux.zod')) self.assertIs(Endpoint.from_flag('endpoint.foo.qux'), endpoint) self.assertIs(Endpoint.from_flag('foo.qux'), endpoint)
def test_from_flag(self): Endpoint._endpoints['foo'] = endpoint = Endpoint('foo') self.assertIsNone(Endpoint.from_flag('foo')) self.assertIsNone(Endpoint.from_flag('bar.qux.zod')) # should return None for unset flag self.assertIsNone(Endpoint.from_flag('endpoint.foo.qux')) # once flag is set, should return the endpoint set_flag('endpoint.foo.qux') self.assertIs(Endpoint.from_flag('endpoint.foo.qux'), endpoint) set_flag('foo.qux') self.assertIs(Endpoint.from_flag('foo.qux'), endpoint)