<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Helvetica;
panose-1:2 11 6 4 2 2 2 2 2 4;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.apple-style-span
{mso-style-name:apple-style-span;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1446997026;
mso-list-type:hybrid;
mso-list-template-ids:2046717848 214097270 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:-;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:27.0pt;
text-indent:-.25in;
font-family:"Calibri","sans-serif";
mso-fareast-font-family:Calibri;
mso-bidi-font-family:"Times New Roman";}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:63.0pt;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:99.0pt;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:135.0pt;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:171.0pt;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:207.0pt;
text-indent:-.25in;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:\F0B7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:243.0pt;
text-indent:-.25in;
font-family:Symbol;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:279.0pt;
text-indent:-.25in;
font-family:"Courier New";}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:\F0A7;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:315.0pt;
text-indent:-.25in;
font-family:Wingdings;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">It’s a somewhat misleading traceback. The root issue is that a real error is being raised by a client method you forgot to stub out somewhere in your tests.
Make sure that all client API calls are stubbed. When in doubt, stub out more methods but don’t add any expected calls for them and see which one raises an “Unexpected Method Call” error on you.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoListParagraph" style="margin-left:27.0pt;text-indent:-.25in;mso-list:l0 level1 lfo1">
<![if !supportLists]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><span style="mso-list:Ignore">-<span style="font:7.0pt "Times New Roman"">
</span></span></span><![endif]><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Gabriel<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Kuang-Ching Wang [mailto:kc.wang@bigswitch.com]
<br>
<b>Sent:</b> Monday, February 11, 2013 1:06 PM<br>
<b>To:</b> OpenStack Development Mailing List<br>
<b>Subject:</b> [openstack-dev] [horizon] test error when using horizon exception handler<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">While using the horizon exception handler in tabs.py, it works fine in actual execution but triggers the following error in unit test. I wonder if someone knows what I have missed to do in setting up the test to cause this.<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">Thanks!<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">KC<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal">======================================================================<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">ERROR: test_index_monitors (openstack_dashboard.dashboards.project.loadbalancer.tests.LoadBalancerTests)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">----------------------------------------------------------------------<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Traceback (most recent call last):<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/openstack_dashboard/test/helpers.py", line 74, in instance_stub_out<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> return fn(self)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/openstack_dashboard/dashboards/project/loadbalancer/tests.py", line 133, in test_index_monitors<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> res = self.client.get(self.INDEX_URL, args=param)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/django/test/client.py", line 439, in get<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> response = super(Client, self).get(path, data=data, **extra)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/django/test/client.py", line 244, in get<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> return self.request(**r)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 111, in get_response<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> response = callback(request, *callback_args, **callback_kwargs)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/decorators.py", line 38, in dec<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> return view_func(request, *args, **kwargs)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/decorators.py", line 54, in dec<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> return view_func(request, *args, **kwargs)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/decorators.py", line 38, in dec<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> return view_func(request, *args, **kwargs)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/decorators.py", line 86, in dec<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> return view_func(request, *args, **kwargs)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/django/views/generic/base.py", line 48, in view<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> return self.dispatch(request, *args, **kwargs)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in dispatch<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> return handler(request, *args, **kwargs)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/tabs/views.py", line 60, in get<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> context = self.get_context_data(**kwargs)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/tabs/views.py", line 44, in get_context_data<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> exceptions.handle(self.request)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/tabs/views.py", line 42, in get_context_data<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> context["tab_group"].load_tab_data()<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/tabs/base.py", line 122, in load_tab_data<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> exceptions.handle(self.request)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/tabs/base.py", line 119, in load_tab_data<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> tab._data = tab.get_context_data(self.request)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/tabs/base.py", line 450, in get_context_data<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> self.load_table_data()<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/horizon/tabs/base.py", line 434, in load_table_data<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> table.data = data_func()<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/openstack_dashboard/dashboards/project/loadbalancer/tabs.py", line 40, in get_poolstable_data<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> _('Unable to retrieve pools list.'))<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/openstack_dashboard/dashboards/project/loadbalancer/tabs.py", line 36, in get_poolstable_data<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> pools = api.quantum.pools_get(self.tab_group.request)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/openstack_dashboard/api/quantum.py", line 539, in pools_get<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> pools = quantumclient(request).list_pools().get('pools')<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/python_quantumclient-2.1.40.g2bca8ee-py2.7.egg/quantumclient/v2_0/client.py", line 104, in with_params<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> ret = self.function(instance, *args, **kwargs)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/python_quantumclient-2.1.40.g2bca8ee-py2.7.egg/quantumclient/v2_0/client.py", line 532, in list_pools<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> return self.get(self.pools_path, params=_params)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/python_quantumclient-2.1.40.g2bca8ee-py2.7.egg/quantumclient/v2_0/client.py", line 771, in get<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> headers=headers, params=params)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/python_quantumclient-2.1.40.g2bca8ee-py2.7.egg/quantumclient/v2_0/client.py", line 756, in retry_request<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> headers=headers, params=params)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/python_quantumclient-2.1.40.g2bca8ee-py2.7.egg/quantumclient/v2_0/client.py", line 701, in do_request<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> self._handle_fault_response(status_code, replybody)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/python_quantumclient-2.1.40.g2bca8ee-py2.7.egg/quantumclient/v2_0/client.py", line 682, in _handle_fault_response<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> exception_handler_v20(status_code, des_error_body)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> File "/home/nova/gerrit/horizon/.venv/local/lib/python2.7/site-packages/python_quantumclient-2.1.40.g2bca8ee-py2.7.egg/quantumclient/v2_0/client.py", line 84, in exception_handler_v20<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"> message=message)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">TypeError: fake_init_exception() takes exactly 3 arguments (2 given)<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif";color:black">--<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif";color:black">Kuang-Ching (KC) Wang<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif";color:black">Member of Technical Staff -- Big Switch Networks -- <a href="http://www.bigswitch.com/" target="_blank">http://www.bigswitch.com/</a><o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-size:13.5pt;font-family:"Helvetica","sans-serif";color:black"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><o:p> </o:p></p>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>