~ubuntu-branches/ubuntu/trusty/horizon/trusty-updates

« back to all changes in this revision

Viewing changes to openstack_dashboard/dashboards/project/images_and_snapshots/images/tests.py

  • Committer: Package Import Robot
  • Author(s): Adam Gandelman
  • Date: 2013-09-06 11:59:43 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20130906115943-h3td0l7tp16mb9oc
Tags: 1:2013.2~b3-0ubuntu1
* New upstream release.
* debian/control: Minimum python-openstack-auth version >= 1.1.1.
* debian/control: Add python-troveclient.
* debian/static: Refresh static assets for 2013.2~b3.
* debian/patches: ubuntu_local_settings.patch -> ubuntu_settings.patch, also
  patch location of secret key in openstack_dashboard/settings.py

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
import tempfile
22
22
 
23
 
from django.conf import settings
24
 
from django.core.files.uploadedfile import InMemoryUploadedFile
25
 
from django.core.urlresolvers import reverse
26
 
from django.forms.widgets import HiddenInput
 
23
from django.conf import settings  # noqa
 
24
from django.core.files.uploadedfile import InMemoryUploadedFile  # noqa
 
25
from django.core.urlresolvers import reverse  # noqa
 
26
from django.forms.widgets import HiddenInput  # noqa
27
27
from django import http
28
 
from django.test.utils import override_settings
 
28
from django.test.utils import override_settings  # noqa
29
29
 
30
 
from mox import IsA
 
30
from mox import IsA  # noqa
31
31
 
32
32
from horizon import tables as horizon_tables
33
33
from openstack_dashboard import api
34
34
from openstack_dashboard.test import helpers as test
35
35
 
36
 
from openstack_dashboard.dashboards.project.images_and_snapshots.images.forms \
37
 
    import CreateImageForm
 
36
from openstack_dashboard.dashboards.project.images_and_snapshots.images \
 
37
    import forms
38
38
from openstack_dashboard.dashboards.project.images_and_snapshots.images \
39
39
    import tables
40
40
 
50
50
        """
51
51
        post = {
52
52
            'name': u'Ubuntu 11.10',
 
53
            'source_type': u'file',
53
54
            'description': u'Login with admin/admin',
54
55
            'disk_format': u'qcow2',
55
56
            'minimum_disk': 15,
56
57
            'minimum_ram': 512,
57
58
            'is_public': 1}
58
59
        files = {}
59
 
        form = CreateImageForm(post, files)
 
60
        form = forms.CreateImageForm(post, files)
60
61
        self.assertEqual(form.is_valid(), False)
61
62
 
62
63
    @override_settings(HORIZON_IMAGES_ALLOW_UPLOAD=False)
65
66
        If HORIZON_IMAGES_ALLOW_UPLOAD is false, the image_file field widget
66
67
        will be a HiddenInput widget instead of a FileInput widget.
67
68
        """
68
 
        form = CreateImageForm({})
 
69
        form = forms.CreateImageForm({})
69
70
        self.assertEqual(
70
71
            isinstance(form.fields['image_file'].widget, HiddenInput), True)
71
72
 
82
83
        data = {
83
84
            'name': u'Ubuntu 11.10',
84
85
            'description': u'Login with admin/admin',
 
86
            'source_type': u'url',
85
87
            'copy_from': u'http://cloud-images.ubuntu.com/releases/'
86
88
                        u'oneiric/release/ubuntu-11.10-server-cloudimg'
87
89
                        u'-amd64-disk1.img',
121
123
        data = {
122
124
            'name': u'Test Image',
123
125
            'description': u'Login with admin/admin',
 
126
            'source_type': u'file',
124
127
            'image_file': temp_file,
125
128
            'disk_format': u'qcow2',
126
129
            'minimum_disk': 15,