Esempio n. 1
0
    def test_update_gw_device_without_certificate(self):
        # NOTE(salv-orlando): This unit test mocks backend calls rather than
        # leveraging the fake NSX API client
        display_name = 'fake-device'
        neutron_id = 'whatever'
        connector_type = 'stt'
        connector_ip = '1.1.1.1'
        with mock.patch.object(nsxlib, 'do_request') as request_mock:
            expected_req_body = self._create_expected_req_body(
                display_name, neutron_id, connector_type.upper(), connector_ip,
                None)
            l2gwlib.update_gateway_device(self.fake_cluster,
                                          'whatever',
                                          'fake_tenant',
                                          display_name,
                                          neutron_id,
                                          'fake_tz_uuid',
                                          connector_type,
                                          connector_ip,
                                          client_certificate=None)

            request_mock.assert_called_once_with(
                "PUT",
                "/ws.v1/transport-node/whatever",
                jsonutils.dumps(expected_req_body, sort_keys=True),
                cluster=self.fake_cluster)
Esempio n. 2
0
    def test_update_gw_device_without_certificate(self):
        # NOTE(salv-orlando): This unit test mocks backend calls rather than
        # leveraging the fake NSX API client
        display_name = 'fake-device'
        neutron_id = 'whatever'
        connector_type = 'stt'
        connector_ip = '1.1.1.1'
        with mock.patch.object(nsxlib, 'do_request') as request_mock:
            expected_req_body = self._create_expected_req_body(
                display_name, neutron_id, connector_type.upper(),
                connector_ip, None)
            l2gwlib.update_gateway_device(
                self.fake_cluster, 'whatever', 'fake_tenant',
                display_name, neutron_id,
                'fake_tz_uuid', connector_type, connector_ip,
                client_certificate=None)

            request_mock.assert_called_once_with(
                "PUT",
                "/ws.v1/transport-node/whatever",
                jsonutils.dumps(expected_req_body, sort_keys=True),
                cluster=self.fake_cluster)