Exemplo n.º 1
0
    def test_main_update(self, list_nodes, robot_update_mobility):
        """Run the parser.robot.main function for update commands."""
        robot_update_mobility.return_value = {'result': 'test'}

        list_nodes.return_value = []
        args = ['update', '-n', 'traj']
        robot_parser.main(args)
        list_nodes.assert_called_with(self.api, 123, None, None)
        robot_update_mobility.assert_called_with(self.api, 123, 'traj', [])
Exemplo n.º 2
0
    def test_main_mobility(self, mobility_command):
        """Run the parser.robot.main function for mobility commands."""
        mobility_command.return_value = {'result': 'test'}

        # List mobility
        args = ['get', '--list']
        robot_parser.main(args)
        mobility_command.assert_called_with(self.api, 'list')

        # Get mobility
        args = ['get', '-n', 'traj_name,site_name']
        robot_parser.main(args)
        mobility_command.assert_called_with(self.api, 'get',
                                            ('traj_name', 'site_name'))
Exemplo n.º 3
0
    def test_main_mobility(self, mobility_command):
        """Run the parser.robot.main function for mobility commands."""
        mobility_command.return_value = {'result': 'test'}

        # List mobility
        args = ['get', '--list']
        robot_parser.main(args)
        mobility_command.assert_called_with(self.api, 'list')

        # Get mobility
        args = ['get', '-n', 'traj_name,site_name']
        robot_parser.main(args)
        mobility_command.assert_called_with(self.api, 'get',
                                            ('traj_name', 'site_name'))
Exemplo n.º 4
0
    def test_main_status(self, list_nodes, robot_command):
        """Run the parser.robot.main function for status commands."""
        robot_command.return_value = {'result': 'test'}

        list_nodes.return_value = []
        args = ['status']
        robot_parser.main(args)
        list_nodes.assert_called_with(self.api, 123, None, None)
        robot_command.assert_called_with(self.api, 'status', 123, [])

        args = ['status', '-l', 'grenoble,m3,1-2', '-l', 'grenoble,m3,3']
        list_nodes.return_value = ['m3-1', 'm3-2', 'm3-3']  # simplify
        robot_parser.main(args)
        robot_command.assert_called_with(self.api, 'status', 123,
                                         ['m3-1', 'm3-2', 'm3-3'])
Exemplo n.º 5
0
    def test_main_status(self, list_nodes, robot_command):
        """Run the parser.robot.main function for status commands."""
        robot_command.return_value = {'result': 'test'}

        list_nodes.return_value = []
        args = ['status']
        robot_parser.main(args)
        list_nodes.assert_called_with(self.api, 123, None, None)
        robot_command.assert_called_with(self.api, 'status', 123, [])

        args = ['status', '-l', 'grenoble,m3,1-2', '-l', 'grenoble,m3,3']
        list_nodes.return_value = ['m3-1', 'm3-2', 'm3-3']  # simplify
        robot_parser.main(args)
        robot_command.assert_called_with(self.api, 'status', 123,
                                         ['m3-1', 'm3-2', 'm3-3'])
Exemplo n.º 6
0
    def test_main_update(self, list_nodes, robot_update_mobility):
        """Run the parser.robot.main function for update commands."""
        robot_update_mobility.return_value = {'result': 'test'}

        list_nodes.return_value = []
        args = ['update', 'traj,grenoble']
        robot_parser.main(args)
        list_nodes.assert_called_with(self.api, 123, None, None)
        robot_update_mobility.assert_called_with(self.api, 123, 'traj',
                                                 'grenoble', [])

        # Invalid mobility format
        robot_update_mobility.reset_mock()
        args = [
            'update', 'traj', '-l', 'grenoble,m3,1-2', '-l', 'grenoble,m3,3'
        ]
        self.assertRaises(SystemExit, robot_parser.main, args)
        self.assertFalse(robot_update_mobility.called)
Exemplo n.º 7
0
    def test_main_update(self, list_nodes, robot_update_mobility):
        """Run the parser.robot.main function for update commands."""
        robot_update_mobility.return_value = {'result': 'test'}

        list_nodes.return_value = []
        args = ['update', 'traj,grenoble']
        robot_parser.main(args)
        list_nodes.assert_called_with(self.api, 123, None, None)
        robot_update_mobility.assert_called_with(
            self.api, 123, 'traj', 'grenoble', [])

        # Invalid mobility format
        robot_update_mobility.reset_mock()
        args = ['update', 'traj',
                '-l', 'grenoble,m3,1-2',
                '-l', 'grenoble,m3,3']
        self.assertRaises(SystemExit, robot_parser.main, args)
        self.assertFalse(robot_update_mobility.called)
Exemplo n.º 8
0
    def test_main_mobility(self, circuit_command):
        """Run the parser.robot.main function for circuit commands."""
        circuit_command.return_value = {'result': 'test'}

        # List circuits
        args = ['get', '--list']
        robot_parser.main(args)
        circuit_command.assert_called_with(self.api, 'list')

        # List mobility
        args = ['get', '--list', '--site', 'grenoble', '--type', 'predefined']

        robot_parser.main(args)
        circuit_command.assert_called_with(self.api,
                                           'list',
                                           site='grenoble',
                                           type='predefined')

        # Get mobility
        args = ['get', '-n', 'site_name']
        robot_parser.main(args)
        circuit_command.assert_called_with(self.api, 'get', 'site_name')