def test_bridge_with_no_default(self): bridge = Bridge([self.one, self.two, self.three]) assert bridge.execute(['test', 'one']) == 1 assert bridge.execute(['test', 'two']) == 1 assert bridge.execute(['test', 'three']) == 1 assert bridge.execute(['test', 'four']) == 2 assert bridge.execute(['test', 'five']) == 2 assert bridge.execute(['test', 'six']) == '3[six]' self.assertRaises(SystemExit, bridge.execute, ['test', 'seven'])
def test_bridge_with_default_one(self): bridge = Bridge([self.one, self.two, self.three], default=self.one) assert bridge.execute(['test', 'one']) == 1 assert bridge.execute(['test', 'two']) == 1 assert bridge.execute(['test', 'three']) == 1 assert bridge.execute(['test', 'four']) == 2 assert bridge.execute(['test', 'five']) == 2 assert bridge.execute(['test', 'six']) == '3[six]' assert bridge.execute(['test', 'seven']) == 1 assert bridge.execute(['test', 'eight']) == 1
def test_bridge_ordering(self): bridge1 = Bridge([self.one, self.two, self.three]) bridge2 = Bridge([self.two, self.one, self.three]) assert bridge1.execute(['test', 'three']) == 1 assert bridge2.execute(['test', 'three']) == 2
def proxy_main(): v2 = AuroraClientV2CommandProcessor() v1 = AuroraClientV1CommandProcessor() bridge = Bridge([v2, v1], default=v1) bridge.execute(sys.argv)