Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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.')
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)