<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:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-fareast-language:EN-US;}
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;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></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-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’m working on multi-keystone-api-version-tests which aims to provide the ability to run tests using a configurable list of keystone API versions for authentication.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>If two versions of the API are configured, each test would be run using the two versions. <o:p></o:p></p><p class=MsoNormal>In the gate, where we’re short of time, we could test only the latest stable version, but in other tests will have the ability to use more than one version.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The approach I’m considering is based on testscenarios. <o:p></o:p></p><p class=MsoNormal>Thinking about how to implement this I recognized that a solution that works for auth version could be used also to run json / xml, removing the need to have two classes for API test.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The idea I have is to change Base[Service]Test classes and move the client selection logic to BaseTestCase. Something like this:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> def __getattr__(self, attr):<o:p></o:p></p><p class=MsoNormal> if attr in manager.list_of_available_clients:<o:p></o:p></p><p class=MsoNormal> manager.get_client(attr, self.auth_version, self.interface)<o:p></o:p></p><p class=MsoNormal> else:<o:p></o:p></p><p class=MsoNormal> raise AttributeError<o:p></o:p></p><p class=MsoNormal> <o:p></o:p></p><p class=MsoNormal>Where both auth_version and interface can be injected by testscenarios and be different for different test instances.<o:p></o:p></p><p class=MsoNormal>The manager in clients.py could be condensed a bit, using __getattr__ and a list_of_available_clients, mapped to the corresponding service class.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Several tests create a self.client = self.my_favourite_client, which I would need to remove.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>As it would be a relatively substantial change, I wanted to get some input / opinion before I started implementing it.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thanks!<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>andrea<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='mso-fareast-language:EN-GB'>-- <o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-GB'>Andrea Frittoli<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-GB'>IaaS Systems Engineering Team<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-GB'>HP Cloud Services<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-GB'>Tel: +44(0)11731 62324<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>