<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Arial;color: #000000;font-size: 10pt;">
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<div id="divRpF836557" style="direction: ltr;"><br>
</div>
<div></div>
<div>
<div style="direction:ltr; font-family:Arial; color:#000000; font-size:10pt">
<div style="direction:ltr; font-family:Arial; color:#000000; font-size:10pt"><br>
<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>
</div>
</div>
</div>
</div>
</body>
</html>


<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>