Revision 23f2683f api/tests.py
b/api/tests.py | ||
---|---|---|
353 | 353 |
disk=randint(1, 40)) |
354 | 354 |
|
355 | 355 |
def create_images(n=1): |
356 |
users = SynnefoUser.objects.all()
|
|
356 |
owner = SynnefoUser.objects.all()[0]
|
|
357 | 357 |
for i in range(n): |
358 | 358 |
Image.objects.create( |
359 | 359 |
name='Image %d' % (i + 1), |
360 | 360 |
state='ACTIVE', |
361 |
owner=choice(users))
|
|
361 |
owner=owner)
|
|
362 | 362 |
|
363 | 363 |
def create_image_metadata(n=1): |
364 | 364 |
images = Image.objects.all() |
... | ... | |
369 | 369 |
image = choice(images)) |
370 | 370 |
|
371 | 371 |
def create_servers(n=1): |
372 |
users = SynnefoUser.objects.all()
|
|
372 |
owner = SynnefoUser.objects.all()[0]
|
|
373 | 373 |
flavors = Flavor.objects.all() |
374 | 374 |
images = Image.objects.all() |
375 | 375 |
for i in range(n): |
376 | 376 |
VirtualMachine.objects.create( |
377 | 377 |
name='Server %d' % (i + 1), |
378 |
owner=choice(users),
|
|
378 |
owner=owner,
|
|
379 | 379 |
sourceimage=choice(images), |
380 | 380 |
hostid=str(i), |
381 | 381 |
flavor=choice(flavors)) |
Also available in: Unified diff