Folsom unit tests failing with UnknownMethodCallError('auth_token')

Bug #1161901 reported by Julie Pichon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Invalid
Undecided
Unassigned
Folsom
Fix Released
Medium
Julie Pichon

Bug Description

The Folsom unit tests don't work with the new python-keystoneclient 0.2.3, cf. http://lists.openstack.org/pipermail/openstack-dev/2013-March/007038.html

Traceback (most recent call last):
  File "/opt/stack/horizon/horizon/tests/api_tests/keystone_tests.py", line 76, in test_get_default_role
    keystoneclient = self.stub_keystoneclient()
  File "/opt/stack/horizon/horizon/test.py", line 330, in stub_keystoneclient
    self.keystoneclient = self.mox.CreateMock(keystone_client.Client)
  File "/opt/stack/horizon/.venv/lib/python2.7/site-packages/mox.py", line 258, in CreateMock
    new_mock = MockObject(class_to_mock, attrs=attrs)
  File "/opt/stack/horizon/.venv/lib/python2.7/site-packages/mox.py", line 556, in __init__
    attr = getattr(class_to_mock, method)
  File "/opt/stack/horizon/.venv/lib/python2.7/site-packages/mox.py", line 608, in __getattr__
    raise UnknownMethodCallError(name)
UnknownMethodCallError: Method called is not a member of the object: Method called is not a member of the object: auth_token
>> raise UnknownMethodCallError('auth_token')

This is due to https://github.com/openstack/python-keystoneclient/commit/01735608644a8b71d98f7798ccd6549e4db5de48 whereby auth_token started being defined using the @property decorator, which causes problem for mox (fighting for __getattr__ with the decorator).

https://github.com/openstack/horizon/commit/1e867700415b17c29056fb55069b6a3e2b22cf1b fixes the problem on master.

Julie Pichon (jpichon)
Changed in horizon:
status: New → Invalid
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/folsom)

Fix proposed to branch: stable/folsom
Review: https://review.openstack.org/25717

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (stable/folsom)

Reviewed: https://review.openstack.org/25717
Committed: http://github.com/openstack/horizon/commit/32bdf9b94251259726ef5a4f4f348292285cad3c
Submitter: Jenkins
Branch: stable/folsom

commit 32bdf9b94251259726ef5a4f4f348292285cad3c
Author: Sascha Peilicke <email address hidden>
Date: Tue Feb 26 16:03:13 2013 +0100

    Correctly mock keystoneclient.Client.auto_token property with Mox

    Recent Mox doesn't stub out class properties any more (check
    https://code.google.com/p/pymox/issues/detail?id=11), so we have to do
    that manually. Avoids the following error:

    FAIL: test_get_default_role
    (openstack_dashboard.test.api_tests.keystone_tests.RoleAPITests)
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/root/Projects/openstack/horizon/openstack_dashboard/test/api_tests/keystone_tests.py", line 76, in test_get_default_role
        keystoneclient = self.stub_keystoneclient()
      File "/root/Projects/openstack/horizon/openstack_dashboard/test/helpers.py", line 280, in stub_keystoneclient
        self.keystoneclient = self.mox.CreateMock(keystone_client.Client)
      File "/usr/lib/python2.7/site-packages/mox.py", line 258, in CreateMock
        new_mock = MockObject(class_to_mock, attrs=attrs)
      File "/usr/lib/python2.7/site-packages/mox.py", line 556, in __init__
        attr = getattr(class_to_mock, method)
      File "/usr/lib/python2.7/site-packages/mox.py", line 608, in __getattr__
        raise UnknownMethodCallError(name)
    UnknownMethodCallError: Method called is not a member of the object: Method called is not a member of the object: auth_token
    >> raise UnknownMethodCallError('auth_token')

    Change-Id: I54fd0de298dc66344470147d9bcec6b62baf8297
    (cherry picked from commit 1e867700415b17c29056fb55069b6a3e2b22cf1b)
    Fixes bug 1161901

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.