~glance-coresec/glance/trunk

« back to all changes in this revision

Viewing changes to tests/test_data.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:
18
18
from glance.parallax import db
19
19
 
20
20
 
 
21
def make_real_image():
 
22
    """Create a real image record """
 
23
 
 
24
    # TODO(sirp): Create a testing account, and define gflags for
 
25
    # test_swift_username and test_swift_api_key
 
26
    USERNAME = "blah" # fill these out for testing
 
27
    API_KEY = "blah"
 
28
 
 
29
    image = db.image_create(
 
30
        None,
 
31
        dict(name="testsnap",
 
32
             state="available",
 
33
             public=True,
 
34
             image_type="tarball"))
 
35
 
 
36
    location = (
 
37
        "swift://%s:%s@"
 
38
        "auth.api.rackspacecloud.com/v1.0/cloudservers"
 
39
        "/testsnap_cloudserver11037.tar.gz.0"
 
40
    ) % (USERNAME, API_KEY)
 
41
 
 
42
    size = 198848316
 
43
 
 
44
    db.image_file_create(None, 
 
45
        dict(image_id=image.id, location=location, size=size))
 
46
 
 
47
 
21
48
def make_fake_image():
22
49
    """Create a fake image record """
23
50
    image = db.image_create(
47
74
 
48
75
if __name__ == "__main__":
49
76
    make_fake_image()
 
77
    #make_real_image() # NOTE: uncomment if you have a username and api_key