~ubuntu-branches/ubuntu/trusty/heat/trusty

« back to all changes in this revision

Viewing changes to heat/tests/test_urlfetch.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2014-03-06 17:18:51 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20140306171851-2h4id4c4bsh9xl31
Tags: 2014.1~b3-0ubuntu1
[ Chuck Short ]
* New upstream release.
* debian/patches/adjust-dependencies.patch: Dropped no longer needed.
* debian/control: Add python-troveclient.
* debian/rules: fail to build if testsuite fails.
* debian/patches/use-oslo.sphinx-namespace.patch: Use oslo.sphinx namespace.

[ Adam Gandelman ]
* debian/heat-engine.install: Install /etc/heat/environment.d/*.
  (LP: #1285875).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
1
 
3
2
#
4
3
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
15
14
 
16
15
import requests
17
16
from requests import exceptions
18
 
import cStringIO
19
17
 
20
18
from oslo.config import cfg
 
19
from six.moves import cStringIO
21
20
 
22
21
from heat.common import urlfetch
23
22
from heat.tests.common import HeatTestCase
53
52
        url = 'file:///etc/profile'
54
53
 
55
54
        self.m.StubOutWithMock(urlutils, 'urlopen')
56
 
        urlutils.urlopen(url).AndReturn(cStringIO.StringIO(data))
 
55
        urlutils.urlopen(url).AndReturn(cStringIO(data))
57
56
        self.m.ReplayAll()
58
57
 
59
58
        self.assertEqual(data, urlfetch.get(url, allowed_schemes=['file']))
75
74
        response = Response(data)
76
75
        requests.get(url, stream=True).AndReturn(response)
77
76
        self.m.ReplayAll()
78
 
        self.assertEqual(urlfetch.get(url), data)
 
77
        self.assertEqual(data, urlfetch.get(url))
79
78
        self.m.VerifyAll()
80
79
 
81
80
    def test_https_scheme(self):
84
83
        response = Response(data)
85
84
        requests.get(url, stream=True).AndReturn(response)
86
85
        self.m.ReplayAll()
87
 
        self.assertEqual(urlfetch.get(url), data)
 
86
        self.assertEqual(data, urlfetch.get(url))
88
87
        self.m.VerifyAll()
89
88
 
90
89
    def test_http_error(self):