Merge remote-tracking branch 'horizon/master' into auth-fix
This commit is contained in:
commit
652277911c
@ -44,13 +44,30 @@ class CreateImageForm(forms.SelfHandlingForm):
|
||||
description = forms.CharField(widget=forms.widgets.Textarea(),
|
||||
label=_("Description"),
|
||||
required=False)
|
||||
|
||||
source_type = forms.ChoiceField(
|
||||
label=_('Image Source'),
|
||||
choices=[('url', _('Image Location')),
|
||||
('file', _('Image File'))],
|
||||
widget=forms.Select(attrs={
|
||||
'class': 'switchable',
|
||||
'data-slug': 'source'}))
|
||||
|
||||
copy_from = forms.CharField(max_length="255",
|
||||
label=_("Image Location"),
|
||||
help_text=_("An external (HTTP) URL to load "
|
||||
"the image from."),
|
||||
widget=forms.TextInput(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'source',
|
||||
'data-source-url': _('Image Location')}),
|
||||
required=False)
|
||||
image_file = forms.FileField(label=_("Image File"),
|
||||
help_text=("A local image to upload."),
|
||||
widget=forms.FileInput(attrs={
|
||||
'class': 'switched',
|
||||
'data-switch-on': 'source',
|
||||
'data-source-file': _('Image File')}),
|
||||
required=False)
|
||||
disk_format = forms.ChoiceField(label=_('Format'),
|
||||
required=True,
|
||||
|
@ -50,6 +50,7 @@ class CreateImageFormTests(test.TestCase):
|
||||
"""
|
||||
post = {
|
||||
'name': u'Ubuntu 11.10',
|
||||
'source_type': u'file',
|
||||
'description': u'Login with admin/admin',
|
||||
'disk_format': u'qcow2',
|
||||
'minimum_disk': 15,
|
||||
@ -82,6 +83,7 @@ class ImageViewTests(test.TestCase):
|
||||
data = {
|
||||
'name': u'Ubuntu 11.10',
|
||||
'description': u'Login with admin/admin',
|
||||
'source_type': u'url',
|
||||
'copy_from': u'http://cloud-images.ubuntu.com/releases/'
|
||||
u'oneiric/release/ubuntu-11.10-server-cloudimg'
|
||||
u'-amd64-disk1.img',
|
||||
@ -121,6 +123,7 @@ class ImageViewTests(test.TestCase):
|
||||
data = {
|
||||
'name': u'Test Image',
|
||||
'description': u'Login with admin/admin',
|
||||
'source_type': u'file',
|
||||
'image_file': temp_file,
|
||||
'disk_format': u'qcow2',
|
||||
'minimum_disk': 15,
|
||||
|
@ -17,14 +17,15 @@ from datetime import timedelta
|
||||
from django.conf import settings
|
||||
from django.utils import datetime_safe
|
||||
|
||||
from keystoneclient.access import AccessInfo
|
||||
from keystoneclient.v2_0 import ec2
|
||||
from keystoneclient.v2_0 import roles
|
||||
from keystoneclient.v2_0 import tenants
|
||||
from keystoneclient.v2_0 import tokens
|
||||
from keystoneclient.v2_0 import users
|
||||
from keystoneclient.v3 import domains
|
||||
from keystoneclient.v3 import groups
|
||||
|
||||
from openstack_auth.user import Token
|
||||
|
||||
from openstack_dashboard.test.test_data.utils import TestDataContainer
|
||||
|
||||
@ -223,22 +224,41 @@ def data(TEST):
|
||||
tomorrow = datetime_safe.datetime.now() + timedelta(days=1)
|
||||
expiration = datetime_safe.datetime.isoformat(tomorrow)
|
||||
|
||||
scoped_token = tokens.Token(tokens.TokenManager,
|
||||
dict(token={"id": "test_token_id",
|
||||
"expires": expiration,
|
||||
"tenant": tenant_dict,
|
||||
"tenants": [tenant_dict]},
|
||||
user={"id": "test_user_id",
|
||||
"name": "test_user",
|
||||
"roles": [member_role_dict]},
|
||||
serviceCatalog=TEST.service_catalog))
|
||||
unscoped_token = tokens.Token(tokens.TokenManager,
|
||||
dict(token={"id": "test_token_id",
|
||||
"expires": expiration},
|
||||
user={"id": "test_user_id",
|
||||
"name": "test_user",
|
||||
"roles": [member_role_dict]},
|
||||
serviceCatalog=TEST.service_catalog))
|
||||
scoped_token_dict = {
|
||||
'access': {
|
||||
'token': {
|
||||
'id': "test_token_id",
|
||||
'expires': expiration,
|
||||
'tenant': tenant_dict,
|
||||
'tenants': [tenant_dict]},
|
||||
'user': {
|
||||
'id': "test_user_id",
|
||||
'name': "test_user",
|
||||
'roles': [member_role_dict]},
|
||||
'serviceCatalog': TEST.service_catalog
|
||||
}
|
||||
}
|
||||
|
||||
scoped_access_info = AccessInfo.factory(resp=None,
|
||||
body=scoped_token_dict)
|
||||
|
||||
unscoped_token_dict = {
|
||||
'access': {
|
||||
'token': {
|
||||
'id': "test_token_id",
|
||||
'expires': expiration},
|
||||
'user': {
|
||||
'id': "test_user_id",
|
||||
'name': "test_user",
|
||||
'roles': [member_role_dict]},
|
||||
'serviceCatalog': TEST.service_catalog
|
||||
}
|
||||
}
|
||||
unscoped_access_info = AccessInfo.factory(resp=None,
|
||||
body=unscoped_token_dict)
|
||||
|
||||
scoped_token = Token(scoped_access_info)
|
||||
unscoped_token = Token(unscoped_access_info)
|
||||
TEST.tokens.add(scoped_token, unscoped_token)
|
||||
TEST.token = scoped_token # your "current" token.
|
||||
TEST.tokens.scoped_token = scoped_token
|
||||
|
Loading…
x
Reference in New Issue
Block a user