Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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.')
Beispiel #7
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)
Beispiel #8
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)
Beispiel #9
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)
Beispiel #10
0
 def test_it_returns_model_list_command(self):
     args = ArgsParserBuilder.build(self.cmd("-list-models"))
     command = Cli.command(args)
     self.assertTrue(command, ModelListCommand)
Beispiel #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)