예제 #1
0
 def test_it_returns_version_command(self):
     args = ArgsParserBuilder.build(self.cmd('-v'))
     self.assertIsInstance(
         Cli.command(ArgsParserBuilder.build(self.cmd('-v'))),
         VersionCommand)
     self.assertIsInstance(
         Cli.command(ArgsParserBuilder.build(self.cmd('--version'))),
         VersionCommand)
예제 #2
0
    def test_it_returns_at_first_authorize_command(self, Routers):
        setup_mocked_routers(Routers)

        args = ArgsParserBuilder.build(self.cmd("-restart manufacturer-model1 usr pas"))

        command = Cli.command(args)
        self.assertTrue(command.commands[0], AuthorizeCommand)
예제 #3
0
    def test_it_returns_at_end_show_wifi_command(self, Routers):
        setup_mocked_routers(Routers)
        args = ArgsParserBuilder.build(
            self.cmd('-wifi-pass manufacturer-model1 usr pas'))

        command = Cli.command(args)
        self.assertIsInstance(command.commands[1], ShowWifiPassCommand)
예제 #4
0
    def test_it_returns_at_end_restart_command(self, Routers):
        setup_mocked_routers(Routers)
        args = ArgsParserBuilder.build(
            self.cmd('-restart manufacturer-model1 usr pas'))

        command = Cli.command(args)
        self.assertTrue(command.commands[1], RestartCommand)
예제 #5
0
    def test_it_returns_chain_command(self, Routers):
        setup_mocked_routers(Routers)
        args = ArgsParserBuilder.build(
            self.cmd('-restart manufacturer-model1 usr pas'))

        command = Cli.command(args)
        self.assertIsInstance(command, ChainCommand)
예제 #6
0
def run():
    print("Croutera...")

    args = ArgsParserBuilder.build(sys.argv[1:])
    if not Cli.validate(args):
        show_help()
        return

    cmd = Cli.command(args)
    if cmd.valid() and cmd.execute():
        print('Command executed.')
    else:
        print('Command was not executed.')
예제 #7
0
def show_help():
    print('--------HELP-------')
    ArgsParserBuilder.build_help()
예제 #8
0
    def test_it_returns_at_end_show_wifi_command(self, Routers):
        setup_mocked_routers(Routers)
        args = ArgsParserBuilder.build(self.cmd("-wifi-pass manufacturer-model1 usr pas"))

        command = Cli.command(args)
        self.assertIsInstance(command.commands[1], ShowWifiPassCommand)
예제 #9
0
    def test_it_returns_chain_command(self, Routers):
        setup_mocked_routers(Routers)
        args = ArgsParserBuilder.build(self.cmd("-restart manufacturer-model1 usr pas"))

        command = Cli.command(args)
        self.assertIsInstance(command, ChainCommand)
예제 #10
0
 def test_it_returns_version_command(self):
     args = ArgsParserBuilder.build(self.cmd("-v"))
     self.assertIsInstance(Cli.command(ArgsParserBuilder.build(self.cmd("-v"))), VersionCommand)
     self.assertIsInstance(Cli.command(ArgsParserBuilder.build(self.cmd("--version"))), VersionCommand)
예제 #11
0
 def test_it_returns_model_list_command(self):
     args = ArgsParserBuilder.build(self.cmd("-list-models"))
     command = Cli.command(args)
     self.assertTrue(command, ModelListCommand)
예제 #12
0
 def test_it_returns_model_list_command(self):
     args = ArgsParserBuilder.build(self.cmd('-list-models'))
     command = Cli.command(args)
     self.assertTrue(command, ModelListCommand)