def command(args): """ Retrive command by args """ if args.version: return VersionCommand() if args.list_models: return ModelListCommand() manufacturer = extractor.extract_manufacturer(args.model) model = extractor.extract_model(args.model) router = Routers.get(manufacturer, model) chain = ChainCommand() chain.add(AuthorizeCommand(router, args.username, args.password)) if args.wifi_pass: chain.add(ShowWifiPassCommand(router)) return chain if args.restart: chain.add(RestartCommand(router)) return chain
def test_it_extract_model(self): self.assertEqual('model', extractor.extract_model(self.args_model))