<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap:break-word; color:rgb(0,0,0); font-size:14px; font-family:Calibri,sans-serif">
<div>Hi <span style="font-family:Arial; font-size:13px">Abhijeet,</span></div>
<div><span style="font-family:Arial; font-size:13px"><br>
</span></div>
<div><span style="font-family:Arial; font-size:13px">Why do not use the oslo library for it? I mean, maybe you can define or find a specific class related to testing process there, where you can put this method.</span></div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; border-bottom:medium none; border-left:medium none; padding-bottom:0in; padding-left:0in; padding-right:0in; border-top:#b5c4df 1pt solid; border-right:medium none; padding-top:3pt">
<span style="font-weight:bold">De: </span>Abhijeet Jain <<a href="mailto:abhijeet.jain@nectechnologies.in">abhijeet.jain@nectechnologies.in</a>><br>
<span style="font-weight:bold">Responder a: </span>"OpenStack Development Mailing List (not for usage questions)" <<a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a>><br>
<span style="font-weight:bold">Fecha: </span>Wednesday 21 May 2014 13:27<br>
<span style="font-weight:bold">Para: </span>"<a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a>" <<a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a>><br>
<span style="font-weight:bold">Asunto: </span>[openstack-dev] A proposal for code reduction<br>
</div>
<div><br>
</div>
<div dir="ltr"><style type="text/css" id="owaParaStyle">
<!--
-->
</style>
<div>
<div style="direction:ltr; font-family:Arial; color:#000000; font-size:10pt">
<div>Hi Openstack-developers,</div>
<div><br>
</div>
<div>I am Abhijeet Jain. One of the contributor in OpenStack.</div>
<div><br>
</div>
<div>I was just working on optimizing the codes in Neutron , Keystone, Cinder modules.</div>
<div>Then, I came across with a very common scenario that I can see at many places.</div>
<div>at many places, I saw that the users have written the code in such form :</div>
<div><br>
</div>
<div>assertEqual(user1['id'], user2['id']);</div>
<div><span style="font-size:10pt">assertEqual(user1['name'], user2['name']);</span></div>
<div>assertEqual(user1['status'], user2['status']);</div>
<div>assertEqual(user1['xyz'], user2['xyz']);</div>
<div><br>
</div>
<div><br>
</div>
<div>To optimize such redundancy, I created a help function like below :</div>
<div><br>
</div>
<div>def _check(self, expected, actual, keys):</div>
<div> for key in keys:</div>
<div> assertEqual( expected[key], actual[key])</div>
<div><br>
</div>
<div><br>
</div>
<div>So, everywhere we just need to call this function like this :</div>
<div>_check(user1, user2, ['id', 'name', 'status', 'xyz'])</div>
<div><br>
</div>
<div>So, this way lots of code can be reduced.</div>
<div>but, currently i need to put that function in every test file , I want to use. There is no global space.</div>
<div><br>
</div>
<div>My proposal is :</div>
<div>How about putting this function in some utils like place, which can be accessed in every test function.</div>
<div>but for that, I need your approval.</div>
<div>Kindly, provide your valuable feedback on this.</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Abhijeet Jain</div>
</div>
<pre>DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and
intended
for the named recipient(s) only.
It shall not attach any liability on the originator or NEC or its
affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the
opinions of NEC or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is
strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. .
-----------------------------------------------------------------------------------------------------------------------</pre>
</div>
</div>
</span><br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
Este mensaje se dirige exclusivamente a su destinatario. Puede consultar nuestra política de envío y recepción de correo electrónico en el enlace situado más abajo.<br>
This message is intended exclusively for its addressee. We only send and receive email on the basis of the terms set out at:<br>
http://www.tid.es/ES/PAGINAS/disclaimer.aspx<br>
</font>
</body>
</html>