~glance-coresec/glance/trunk

« back to all changes in this revision

Viewing changes to tests/unit/test_teller_backends.py

  • Committer: Tarmac
  • Author(s): Rick Harris
  • Date: 2010-10-05 16:16:42 UTC
  • mfrom: (8.2.10 refactor_swift_authurl)
  • Revision ID: hudson@openstack.org-20101005161642-0h3ugq7i4x2pqn13
With this patch Parallax and teller now work end-to-end with the Swift backend.

bash-3.2$ curl localhost:9292/image?uri=http://localhost:9191/images/2 > testimg.tar.gz
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 189M 0 189M 0 0 203k 0 --:--:-- 0:15:52 --:--:-- 214k

bash-3.2$ md5 testimg.tar.gz
MD5 (testimg.tar.gz) = ef6c5db4f55b0030828b71dd253a2384

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        class FakeSwift(object):
66
66
            def __init__(self, *args, **kwargs): 
67
67
                pass
 
68
 
68
69
            @classmethod
69
70
            def get_connection(self, *args, **kwargs):
70
71
                auth = Auth("user", "password")
72
73
                conn.connection = CustomHTTPConnection("localhost", 8000)
73
74
                return conn
74
75
 
75
 
        swift_uri="swift://user:password@localhost/container1/file.tar.gz"
 
76
        swift_uri = "swift://user:password@localhost/container1/file.tar.gz"
76
77
        swift_returns = ['I ', 'am', ' a', ' t', 'ea', 'po', 't,', ' s', 
77
78
                         'ho', 'rt', ' a', 'nd', ' s', 'to', 'ut', '\n']
78
79
 
88
89
        class FakeSwift(object):
89
90
            def __init__(self, *args, **kwargs): 
90
91
                pass
 
92
 
91
93
            @classmethod
92
94
            def get_connection(self, *args, **kwargs):
93
95
                auth = Auth("user", "password")
95
97
                conn.connection = CustomHTTPConnection("localhost", 8000)
96
98
                return conn
97
99
 
98
 
        swift_url="swift://localhost/container1/file.tar.gz"
 
100
        swift_url = "swift://localhost/container1/file.tar.gz"
99
101
 
100
102
        self.assertRaises(BackendException, get_from_backend, 
101
103
                          swift_url, expected_size=21)