Example #1
0
 def setUp(self):
     self.cinder_client_exception = cinder_exceptions.ClientException(404)
     self.glance_client_exception = glance_exceptions.ClientException()
     self.keystone_client_exception = keystone_exceptions.ClientException()
     self.neutron_client_exception = neutron_exceptions.NeutronClientException(
     )
     self.nova_client_exception = nova_exceptions.ClientException(404)
Example #2
0
    def test_detail_view_network_not_found(self):
        share_net = test_data.active_share_network
        sec_service = test_data.sec_service
        url = reverse('horizon:project:share_networks:share_network_detail',
                      args=[share_net.id])
        self.mock_object(api_manila, "share_server_list",
                         mock.Mock(return_value=[]))
        self.mock_object(api_manila, "share_network_get",
                         mock.Mock(return_value=share_net))
        self.mock_object(api_manila, "share_network_security_service_list",
                         mock.Mock(return_value=[sec_service]))
        self.mock_object(
            api.neutron, "network_get",
            mock.Mock(
                side_effect=exceptions.NeutronClientException('fake', 500)))
        self.mock_object(
            api.neutron, "subnet_get",
            mock.Mock(
                side_effect=exceptions.NeutronClientException('fake', 500)))

        res = self.client.get(url)

        self.assertContains(
            res, "<h1>Share Network Details: %s</h1>" % share_net.name, 1, 200)
        self.assertContains(res, "<dd>%s</dd>" % share_net.name, 1, 200)
        self.assertContains(res, "<dd>%s</dd>" % share_net.id, 1, 200)
        self.assertContains(res, "<dd>Unknown</dd>", 2, 200)
        self.assertNotContains(res, "<dd>%s</dd>" % share_net.neutron_net_id)
        self.assertNotContains(res,
                               "<dd>%s</dd>" % share_net.neutron_subnet_id)
        self.assertContains(
            res, "<a href=\"/project/security_services"
            "/%s\">%s</a>" % (sec_service.id, sec_service.name), 1, 200)
        self.assertNoMessages()
        api_manila.share_network_security_service_list.assert_called_once_with(
            mock.ANY, share_net.id)
        api_manila.share_server_list.assert_called_once_with(
            mock.ANY, search_opts={'share_network_id': share_net.id})
        api_manila.share_network_get.assert_called_once_with(
            mock.ANY, share_net.id)
        api.neutron.network_get.assert_called_once_with(
            mock.ANY, share_net.neutron_net_id)
        api.neutron.subnet_get.assert_called_once_with(
            mock.ANY, share_net.neutron_subnet_id)
Example #3
0
 def raise_neutron_exc(*args, **kwargs):
     raise exceptions.NeutronClientException('fake', 500)