Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f3ef3c2a
authored
Apr 25, 2016
by
Dudás Ádám
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-446-v2' into 'master'
Fix crispy forms error Close #446 See merge request !369
parents
cb2d9cff
786cff68
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
30 deletions
+76
-30
circle/dashboard/tests/test_views.py
+73
-27
requirements/base.txt
+3
-3
No files found.
circle/dashboard/tests/test_views.py
View file @
f3ef3c2a
...
...
@@ -270,33 +270,6 @@ class VmDetailTest(LoginMixin, MockCeleryMixin, TestCase):
self
.
assertEqual
(
InstanceTemplate
.
objects
.
get
(
id
=
1
)
.
raw_data
,
"<devices></devices>"
)
def
test_permitted_lease_delete_w_template_using_it
(
self
):
c
=
Client
()
self
.
login
(
c
,
'superuser'
)
leases
=
Lease
.
objects
.
count
()
response
=
c
.
post
(
"/dashboard/lease/delete/1/"
)
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertEqual
(
leases
,
Lease
.
objects
.
count
())
def
test_permitted_lease_delete_w_template_not_using_it
(
self
):
c
=
Client
()
self
.
login
(
c
,
'superuser'
)
lease
=
Lease
.
objects
.
create
(
name
=
"yay"
)
leases
=
Lease
.
objects
.
count
()
response
=
c
.
post
(
"/dashboard/lease/delete/
%
d/"
%
lease
.
pk
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
leases
-
1
,
Lease
.
objects
.
count
())
def
test_unpermitted_lease_delete
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user1'
)
leases
=
Lease
.
objects
.
count
()
response
=
c
.
post
(
"/dashboard/lease/delete/1/"
)
# redirect to the login page
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
leases
,
Lease
.
objects
.
count
())
def
test_notification_read
(
self
):
c
=
Client
()
self
.
login
(
c
,
"user1"
)
...
...
@@ -1758,3 +1731,76 @@ class SshKeyTest(LoginMixin, TestCase):
resp
=
c
.
post
(
"/dashboard/sshkey/delete/1/"
)
self
.
assertEqual
(
403
,
resp
.
status_code
)
class
LeaseDetailTest
(
LoginMixin
,
TestCase
):
fixtures
=
[
'test-vm-fixture.json'
,
]
def
setUp
(
self
):
self
.
u1
=
User
.
objects
.
create
(
username
=
'user1'
)
self
.
u1
.
set_password
(
'password'
)
self
.
u1
.
save
()
self
.
u2
=
User
.
objects
.
create
(
username
=
'user2'
,
is_staff
=
True
)
self
.
u2
.
set_password
(
'password'
)
self
.
u2
.
save
()
self
.
us
=
User
.
objects
.
create
(
username
=
'superuser'
,
is_superuser
=
True
)
self
.
us
.
set_password
(
'password'
)
self
.
us
.
save
()
def
tearDown
(
self
):
super
(
LeaseDetailTest
,
self
)
.
tearDown
()
self
.
u1
.
delete
()
self
.
u2
.
delete
()
self
.
us
.
delete
()
def
test_anon_view
(
self
):
c
=
Client
()
response
=
c
.
get
(
"/dashboard/lease/1/"
)
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_unpermitted_view
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user1'
)
response
=
c
.
get
(
"/dashboard/lease/1/"
)
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_operator_view
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user2'
)
lease
=
Lease
.
objects
.
get
()
lease
.
set_level
(
self
.
u2
,
"owner"
)
response
=
c
.
get
(
"/dashboard/lease/1/"
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_superuser_view
(
self
):
c
=
Client
()
self
.
login
(
c
,
'superuser'
)
response
=
c
.
get
(
"/dashboard/lease/1/"
)
self
.
assertEqual
(
response
.
status_code
,
200
)
def
test_permitted_lease_delete_w_template_using_it
(
self
):
c
=
Client
()
self
.
login
(
c
,
'superuser'
)
leases
=
Lease
.
objects
.
count
()
response
=
c
.
post
(
"/dashboard/lease/delete/1/"
)
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertEqual
(
leases
,
Lease
.
objects
.
count
())
def
test_permitted_lease_delete_w_template_not_using_it
(
self
):
c
=
Client
()
self
.
login
(
c
,
'superuser'
)
lease
=
Lease
.
objects
.
create
(
name
=
"yay"
)
leases
=
Lease
.
objects
.
count
()
response
=
c
.
post
(
"/dashboard/lease/delete/
%
d/"
%
lease
.
pk
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
leases
-
1
,
Lease
.
objects
.
count
())
def
test_unpermitted_lease_delete
(
self
):
c
=
Client
()
self
.
login
(
c
,
'user1'
)
leases
=
Lease
.
objects
.
count
()
response
=
c
.
post
(
"/dashboard/lease/delete/1/"
)
# redirect to the login page
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
leases
,
Lease
.
objects
.
count
())
requirements/base.txt
View file @
f3ef3c2a
amqp==1.4.6
anyjson==0.3.3
arrow==0.
6
.0
arrow==0.
7
.0
billiard==3.3.0.20
bpython==0.14.1
celery==3.1.18
Django==1.8.2
Django==1.8.
1
2
django-appconf==1.0.1
django-autocomplete-light==2.1.1
django-braces==1.8.0
django-crispy-forms==1.
4
.0
django-crispy-forms==1.
6
.0
django-model-utils==2.2
djangosaml2==0.13.0
django-sizefield==0.7
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment