Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Modifying unit tests according to policy.json

I'd like to know what changes need to be made to unit tests when role changes for an action in policy.json.

For example, I made the below change to Neutron policy.json

From: "create_port": "" to "create_port": "role:my_network_role".

Neutron unit test "test_create_port_public_network" fails due to this change. I can make it work by making a code change to get the admin context but my mind tells me this is not the way. The current code generates neutron context the below way which is not admin context...

 port_req.environ['neutron.context'] = context.Context("'', kwargs['tenant_id'])

Can someone help me with it? How do I change the tests to use my newly created role?