Exemplo n.º 1
0
    def test_node_set_name(self, m_emit_one):
        self.m_client._updatable_attributes = \
            node.NodeClient._updatable_attributes
        node_id = 37
        expected_field_data = cmd_node.NodeShow.columns

        test_cases = ('new-name', 'New Name', 'śćż∑ Pó', '你一定是无聊')
        for name in test_cases:
            self.m_client.update.return_value = fake_node.get_fake_node(
                node_id=node_id, node_name=name)

            cmd = ['node', 'update', str(node_id), '--name', name]

            # NOTE(sbrzeczkowski): due to shlex inability to accept
            # unicode arguments prior to python 2.7.3
            main_mod.main(argv=cmd)

            if six.PY2:
                name = name.decode('utf-8')

            m_emit_one.assert_called_with(expected_field_data,
                                          mock.ANY,
                                          mock.ANY,
                                          mock.ANY)
            self.m_get_client.assert_called_once_with('node', mock.ANY)
            self.m_client.update.assert_called_once_with(
                node_id, name=name)
            self.m_get_client.reset_mock()
            self.m_client.reset_mock()
Exemplo n.º 2
0
    def exec_command(self, command=''):
        """Executes fuelclient with the specified arguments."""
        argv = shlex.split(command)
        if '--debug' not in argv:
            argv = ['--debug'] + argv

        return main_mod.main(argv=argv)
Exemplo n.º 3
0
    def exec_command(self, command=''):
        """Executes fuelclient with the specified arguments."""

        return main_mod.main(argv=shlex.split(command))
Exemplo n.º 4
0
    def exec_command(self, command=''):
        """Executes fuelclient with the specified arguments."""

        return main_mod.main(argv=shlex.split(command))