test_url_for in openstack_dashboard.test.unit.api.test_base fails if UT runs only with this module

Bug #1815285 reported by Akihiro Motoki
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Low
Akihiro Motoki

Bug Description

When we run openstack_dashboard.test.unit.api.test_base only, test_url_for fails.

======================================================================
ERROR: test_url_for (openstack_dashboard.test.unit.api.test_base.ApiHelperTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tipica/work/horizon/openstack_dashboard/test/unit/api/test_base.py", line 243, in test_url_for
    url = api_base.url_for(self.request, 'image')
  File "/home/tipica/work/horizon/openstack_dashboard/api/base.py", line 332, in url_for
    catalog = request.user.service_catalog
  File "/home/tipica/work/horizon/.tox/py27/local/lib/python2.7/site-packages/django/utils/functional.py", line 239, in inner
    return func(self._wrapped, *args)
AttributeError: 'AnonymousUser' object has no attribute 'service_catalog'

----------------------------------------------------------------------
Ran 22 tests in 0.403s

Akihiro Motoki (amotoki)
Changed in horizon:
importance: Undecided → Low
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/636012

Changed in horizon:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/636012
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=4bf069bb9292710ed86be245c1b091b0a7a7d678
Submitter: Zuul
Branch: master

commit 4bf069bb9292710ed86be245c1b091b0a7a7d678
Author: Akihiro Motoki <email address hidden>
Date: Sat Feb 9 21:12:50 2019 +0900

    Ensure to call patch_middleware_get_user() in api.test_base

    ApiHelperTests.test_url_for in openstack_dashboard.test.unit.api.test_base
    depends on keystone user and token information. To make this work,
    we need to call utils.patch_middleware_get_user().
    This commit changes ApiHelperTests to inherit APITestCase.

    Change-Id: I3848f756604262b07700a65e9be5bacd48da191f
    Closes-Bug: #1815285

Changed in horizon:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/641469

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 15.0.0.0b2

This issue was fixed in the openstack/horizon 15.0.0.0b2 development milestone.

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

Reviewed: https://review.opendev.org/641469
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=e5bc4dfb41b072b3bebe357a53f0c85972c202f2
Submitter: Zuul
Branch: stable/rocky

commit e5bc4dfb41b072b3bebe357a53f0c85972c202f2
Author: Akihiro Motoki <email address hidden>
Date: Sat Feb 9 21:12:50 2019 +0900

    Ensure to call patch_middleware_get_user() in api.test_base

    ApiHelperTests.test_url_for in openstack_dashboard.test.unit.api.test_base
    depends on keystone user and token information. To make this work,
    we need to call utils.patch_middleware_get_user().
    This commit changes ApiHelperTests to inherit APITestCase.

    Change-Id: I3848f756604262b07700a65e9be5bacd48da191f
    Closes-Bug: #1815285
    (cherry picked from commit 4bf069bb9292710ed86be245c1b091b0a7a7d678)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/horizon 14.0.4

This issue was fixed in the openstack/horizon 14.0.4 release.

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.