← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1543073] [NEW] keystoneclient API misused in MappingsViewTests

 

Public bug reported:

The test
openstack_dashboard.dashboards.identity.mappings.tests.MappingsViewTests.test_index()
uses a keystoneclient.v3.contrib.federation.mappings.Mapping object
created by the data() function of
openstack_dashboard/test/test_data/keystone_data.py. Problem: data()
pass the keystoneclient.v3.contrib.federation.mappings.MappingManager
*class* to Mapping constructor, whereas it should pass an instance.

keystoneclient.v3.contrib.federation.mappings.MappingManager constructor
(keystoneclient.base.Manager constructor) has a client parameter but I
don't know how to create such client: "instance of BaseClient descendant
for HTTP requests".

The bug is hidden on Python 2 in
horizon.tables.base.DataTable.get_object_display() by hasattr(datum,
'name'), because hasattr() ignores *all* exceptions.

I found this bug when running the test on Python 3, since hasattr() now
only catchs AttributeError.

I proposed https://review.openstack.org/#/c/275265/ to mimick hasattr()
Python 2 beheaviour on Python 3 in
horizon.tables.base.DataTable.get_object_display().

** Affects: horizon
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1543073

Title:
  keystoneclient API misused in MappingsViewTests

Status in OpenStack Dashboard (Horizon):
  New

Bug description:
  The test
  openstack_dashboard.dashboards.identity.mappings.tests.MappingsViewTests.test_index()
  uses a keystoneclient.v3.contrib.federation.mappings.Mapping object
  created by the data() function of
  openstack_dashboard/test/test_data/keystone_data.py. Problem: data()
  pass the keystoneclient.v3.contrib.federation.mappings.MappingManager
  *class* to Mapping constructor, whereas it should pass an instance.

  keystoneclient.v3.contrib.federation.mappings.MappingManager
  constructor (keystoneclient.base.Manager constructor) has a client
  parameter but I don't know how to create such client: "instance of
  BaseClient descendant for HTTP requests".

  The bug is hidden on Python 2 in
  horizon.tables.base.DataTable.get_object_display() by hasattr(datum,
  'name'), because hasattr() ignores *all* exceptions.

  I found this bug when running the test on Python 3, since hasattr()
  now only catchs AttributeError.

  I proposed https://review.openstack.org/#/c/275265/ to mimick
  hasattr() Python 2 beheaviour on Python 3 in
  horizon.tables.base.DataTable.get_object_display().

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1543073/+subscriptions


Follow ups