Example #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)
Example #2
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.')
Example #3
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)
Example #4
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)
Example #5
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)
Example #6
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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)