def test_do_port_show_fields(self):
     client_mock = mock.MagicMock()
     args = mock.MagicMock()
     args.port = "port_uuid"
     args.address = False
     args.fields = [["uuid", "address"]]
     p_shell.do_port_show(client_mock, args)
     client_mock.port.get.assert_called_once_with("port_uuid", fields=["uuid", "address"])
Esempio n. 2
0
 def test_do_port_show_fields(self):
     client_mock = mock.MagicMock()
     args = mock.MagicMock()
     args.port = 'port_uuid'
     args.address = False
     args.fields = [['uuid', 'address']]
     p_shell.do_port_show(client_mock, args)
     client_mock.port.get.assert_called_once_with(
         'port_uuid', fields=['uuid', 'address'])
    def test_do_port_show_by_address(self):
        client_mock = mock.MagicMock()
        args = mock.MagicMock()
        args.port = 'port_address'
        args.address = True

        p_shell.do_port_show(client_mock, args)
        client_mock.port.get_by_address.assert_called_once_with('port_address')
        # assert get() wasn't called
        self.assertFalse(client_mock.port.get.called)
Esempio n. 4
0
    def test_do_port_show_by_address(self):
        client_mock = mock.MagicMock()
        args = mock.MagicMock()
        args.port = 'port_address'
        args.address = True

        p_shell.do_port_show(client_mock, args)
        client_mock.port.get_by_address.assert_called_once_with('port_address')
        # assert get() wasn't called
        self.assertFalse(client_mock.port.get.called)
    def test_do_port_show(self):
        client_mock = mock.MagicMock()
        args = mock.MagicMock()
        args.port = 'port_uuid'
        args.address = False

        p_shell.do_port_show(client_mock, args)
        client_mock.port.get.assert_called_once_with('port_uuid')
        # assert get_by_address() wasn't called
        client_mock.port.get_by_address.assert_not_called()
Esempio n. 6
0
    def test_do_port_show(self):
        client_mock = mock.MagicMock()
        args = mock.MagicMock()
        args.port = 'port_uuid'
        args.address = False
        args.fields = None

        p_shell.do_port_show(client_mock, args)
        client_mock.port.get.assert_called_once_with('port_uuid', fields=None)
        # assert get_by_address() wasn't called
        self.assertFalse(client_mock.port.get_by_address.called)