[openstack-dev] [OpenStack][python-quantumclient] unit test question
Kuang-Ching Wang
kuangching.wang at gmail.com
Thu Jun 27 19:52:31 UTC 2013
Ilya, thanks for digging this far! Any advice on how to fix this issue?
Thanks!
KC
On Jun 27, 2013, at 9:42 AM, Ilya Shakhat wrote:
> KC, it looks like I've found the cause, and it is related to the way how firewall_rules_list is serialized/deserialized.
>
> After fixing issue with plural form of firewall_policy (quantum/v2_0/__init__.py line # 511), tox fails only with one error in test_create_firewall_policy_with_all_params for xml format. The issue is that mox doesn't get message body it is told to catch. The difference is visible in test_cli20 #137 (MyComparator.equals):
> expects:
> {'firewall_policy': {'firewall_rules_list': ['rule_id1'], 'tenant_id': 'my-tenant', 'name': 'my-name', 'admin_state_up': True}}
> gets:
> {'firewall_policy': {'firewall_rules_list': {'item': 'rule_id1'}, 'tenant_id': 'my-tenant', 'name': 'my-name', 'admin_state_up': True}}
>
> Ilya.
>
> 2013/6/27 Kuang-Ching Wang <kuangching.wang at gmail.com>
> Ilya, thanks for catching this - I took care of the plural, though the POST error earlier still persists.
>
> Any idea why the expected call breaks into two sections - the call itself and the body separated?
>
> KC
>
> On Jun 26, 2013, at 1:18 PM, Ilya Shakhat wrote:
>
>> Hi KC,
>>
>> There's one more place in code that relies on rule of making plurals, it adds letter 's' producing 'policys' instead of 'policies'. The code is in quantum/v2_0/__init__.py line # 511.
>>
>> Thanks,
>> Ilya
>>
>> 2013/6/26 Kuang-Ching Wang <kuangching.wang at gmail.com>
>> Hi Eugene,
>>
>> thanks for looking into this. I just pushed my patch: https://review.openstack.org/#/c/33187/
>>
>> Thanks!
>> KC
>>
>> On Jun 25, 2013, at 9:08 PM, Eugene Nikanorov <enikanorov at mirantis.com> wrote:
>>
>>> Hi,
>>>
>>> Can you post the code if failing test?
>>>
>>> Eugene.
>>>
>>>
>>>
>>> On Wed, Jun 26, 2013 at 2:11 AM, Kuang-Ching Wang <kuangching.wang at gmail.com> wrote:
>>> Hi,
>>>
>>> I am seeing the following error and cannot figure out why it happened and how to solve it. Any advice would be appreciated. Thanks!
>>>
>>> UnexpectedMethodCallError: Unexpected method call. unexpected:- expected:+
>>> - request.__call__('localurl/v2.0/firewall_policies.xml', 'POST', body='<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<firewall_policy xmlns="http://openstack.org/quantum/api/v2.0" xmlns:quantum="http://openstack.org/quantum/api/v2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><description>my-desc</description><admin_state_up quantum:type="bool">True</admin_state_up><tenant_id>my-tenant</tenant_id><firewall_rules_list><item>rule_id1</item></firewall_rules_list><shared quantum:type="bool">True</shared><audited quantum:type="bool">True</audited><name>my-name</name></firewall_policy>', headers={'X-Auth-Token': 'testtoken', 'Content-Type': 'application/xml', 'Accept': 'application/xml', 'User-Agent': 'python-quantumclient'}) -> None
>>> + request.__call__('localurl/v2.0/firewall_policies.xml', 'POST', body=<?xml version='1.0' encoding='UTF-8'?>
>>>
>>> + <firewall_policy xmlns="http://openstack.org/quantum/api/v2.0" xmlns:quantum="http://openstack.org/quantum/api/v2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><tenant_id>my-tenant</tenant_id><description>my-desc</description><admin_state_up quantum:type="bool">True</admin_state_up><firewall_rules_list><item>rule_id1</item></firewall_rules_list><shared quantum:type="bool">True</shared><audited quantum:type="bool">True</audited><name>my-name</name></firewall_policy>, headers=<map containing the entry 'X-Auth-Token: testtoken'>) -> (<tests.unit.test_cli20.MyResp object at 0x3156d90>, '<?xml version=\'1.0\' encoding=\'UTF-8\'?>\n<firewall_policy xmlns="http://openstack.org/quantum/api/v2.0" xmlns:quantum="http://openstack.org/quantum/api/v2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><id>myid</id><name>my-name</name></firewall_policy>')
>>>
>>> KC
>>>
>>>
>>> _______________________________________________
>>> OpenStack-dev mailing list
>>> OpenStack-dev at lists.openstack.org
>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>>
>>> _______________________________________________
>>> OpenStack-dev mailing list
>>> OpenStack-dev at lists.openstack.org
>>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>>
>>
>> _______________________________________________
>> OpenStack-dev mailing list
>> OpenStack-dev at lists.openstack.org
>> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20130627/8dd2762e/attachment.html>
More information about the OpenStack-dev
mailing list