~ubuntu-branches/ubuntu/saucy/horizon/saucy-updates

« back to all changes in this revision

Viewing changes to horizon/test/tests/base.py

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Chuck Short
  • Date: 2013-10-03 13:48:12 UTC
  • mfrom: (1.1.31)
  • Revision ID: package-import@ubuntu.com-20131003134812-2vkwosem4flwuk5y
Tags: 1:2013.2~rc1-0ubuntu1
[ James Page ]
* New upstream release candidate:
  - d/static: Refreshed static assets for 2013.2~rc1.
  - d/patches: Refreshed patches.

[ Chuck Short ]
* debian/control: Add python-lesscpy as a suggests to optionally
  support online compression of static assets (LP: #1226674).

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# Administrator of the National Aeronautics and Space Administration.
5
5
# All Rights Reserved.
6
6
#
7
 
# Copyright 2012 Openstack, LLC
 
7
# Copyright 2012 OpenStack Foundation
8
8
# Copyright 2012 Nebula, Inc.
9
9
#
10
10
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
23
23
from django.contrib.auth.models import User  # noqa
24
24
from django.core import urlresolvers
25
25
from django.utils.importlib import import_module  # noqa
26
 
from django.utils.translation import ugettext_lazy as _  # noqa
27
26
 
28
27
import horizon
29
28
from horizon import base
37
36
 
38
37
 
39
38
class MyDash(horizon.Dashboard):
40
 
    name = _("My Dashboard")
 
39
    name = "My Dashboard"
41
40
    slug = "mydash"
42
41
    default_panel = "myslug"
43
42
 
44
43
 
45
44
class MyPanel(horizon.Panel):
46
 
    name = _("My Panel")
 
45
    name = "My Panel"
47
46
    slug = "myslug"
48
47
    urls = 'horizon.test.test_dashboards.cats.kittens.urls'
49
48
 
50
49
 
51
50
class AdminPanel(horizon.Panel):
52
 
    name = _("Admin Panel")
 
51
    name = "Admin Panel"
53
52
    slug = "admin_panel"
54
53
    permissions = ("horizon.test",)
55
54
    urls = 'horizon.test.test_dashboards.cats.kittens.urls'
237
236
        # Simulate ajax call
238
237
        resp = self.client.get(url, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
239
238
        # Response should be HTTP 401 with redirect header
240
 
        self.assertEquals(resp.status_code, 401)
241
 
        self.assertEquals(resp["X-Horizon-Location"],
242
 
                          redirect_url)
 
239
        self.assertEqual(resp.status_code, 401)
 
240
        self.assertEqual(resp["X-Horizon-Location"],
 
241
                         redirect_url)
243
242
 
244
243
    def test_required_permissions(self):
245
244
        dash = horizon.get_dashboard("cats")
314
313
    def tearDown(self):
315
314
        # Restore dash
316
315
        cats = horizon.get_dashboard("cats")
317
 
        cats.name = _("Cats")
 
316
        cats.name = "Cats"
318
317
        horizon.register(Dogs)
319
318
        self._discovered_dashboards.append(Dogs)
320
319
        Dogs.register(Puppies)