def _test_show_attachment_portnotfound(self, fmt): LOG.debug("_test_show_attachment_portnotfound - fmt:%s - START", fmt) port_state = "ACTIVE" network_id = self._create_network(fmt) self._create_port(network_id, port_state, fmt) get_attachment_req = testlib.get_attachment_request(self.tenant_id, network_id, "A_BAD_ID", fmt) get_attachment_res = get_attachment_req.get_response(self.api) self.assertEqual(get_attachment_res.status_int, self._port_not_found_code) LOG.debug("_test_show_attachment_portnotfound - fmt:%s - END", fmt)
def _test_show_attachment_none_set(self, fmt): LOG.debug("_test_show_attachment_none_set - fmt:%s - START", fmt) content_type = "application/%s" % fmt port_state = "ACTIVE" network_id = self._create_network(fmt) port_id = self._create_port(network_id, port_state, fmt) get_attachment_req = testlib.get_attachment_request(self.tenant_id, network_id, port_id, fmt) get_attachment_res = get_attachment_req.get_response(self.api) attachment_data = self._att_deserializers[content_type].deserialize(get_attachment_res.body)["body"] self.assertTrue("id" not in attachment_data["attachment"]) LOG.debug("_test_show_attachment_none_set - fmt:%s - END", fmt)
def _test_show_attachment(self, fmt): LOG.debug("_test_show_attachment - fmt:%s - START", fmt) content_type = "application/%s" % fmt port_state = "ACTIVE" network_id = self._create_network(fmt) interface_id = "test_interface" port_id = self._create_port(network_id, port_state, fmt) put_attachment_req = testlib.put_attachment_request(self.tenant_id, network_id, port_id, interface_id, fmt) put_attachment_res = put_attachment_req.get_response(self.api) self.assertEqual(put_attachment_res.status_int, 204) get_attachment_req = testlib.get_attachment_request(self.tenant_id, network_id, port_id, fmt) get_attachment_res = get_attachment_req.get_response(self.api) attachment_data = self._att_deserializers[content_type].deserialize(get_attachment_res.body)["body"] self.assertEqual(attachment_data["attachment"]["id"], interface_id) LOG.debug("_test_show_attachment - fmt:%s - END", fmt)