~ubuntu-branches/ubuntu/quantal/horizon/quantal

« back to all changes in this revision

Viewing changes to horizon/test.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-07-06 11:38:55 UTC
  • mfrom: (1.1.16)
  • Revision ID: package-import@ubuntu.com-20120706113855-js8fsldgtool47yj
Tags: 2012.2~f2-0ubuntu1
New usptream version. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#    License for the specific language governing permissions and limitations
19
19
#    under the License.
20
20
 
21
 
import datetime
22
21
import os
23
22
 
24
23
import cloudfiles as swift_client
41
40
from horizon import users
42
41
from horizon.tests.test_data.utils import load_test_data
43
42
 
44
 
from .time import time
45
 
from .time import today
46
 
from .time import utcnow
47
 
 
48
43
 
49
44
# Makes output of failing mox tests much easier to read.
50
45
wsgi.WSGIRequest.__repr__ = lambda self: "<class 'django.http.HttpRequest'>"
156
151
                           authorized_tenants=authorized_tenants,
157
152
                           request=self.request)
158
153
 
159
 
    def override_times(self):
160
 
        """ Overrides the "current" time with immutable values. """
161
 
        now = datetime.datetime.utcnow()
162
 
        time.override_time = \
163
 
                datetime.time(now.hour, now.minute, now.second)
164
 
        today.override_time = datetime.date(now.year, now.month, now.day)
165
 
        utcnow.override_time = now
166
 
        return now
167
 
 
168
 
    def reset_times(self):
169
 
        """ Undoes the changes made by ``override_times``. """
170
 
        time.override_time = None
171
 
        today.override_time = None
172
 
        utcnow.override_time = None
173
 
 
174
154
    def assertRedirectsNoFollow(self, response, expected_url):
175
155
        """
176
156
        Asserts that the given response issued a 302 redirect without