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