Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7e06fcc0
authored
Jan 30, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: lease delete tests
parent
e9e7936b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletions
+18
-1
circle/dashboard/tests/test_views.py
+18
-1
No files found.
circle/dashboard/tests/test_views.py
View file @
7e06fcc0
...
@@ -2,7 +2,7 @@ from django.test import TestCase
...
@@ -2,7 +2,7 @@ from django.test import TestCase
from
django.test.client
import
Client
from
django.test.client
import
Client
from
django.contrib.auth.models
import
User
,
Group
from
django.contrib.auth.models
import
User
,
Group
from
vm.models
import
Instance
,
InstanceTemplate
from
vm.models
import
Instance
,
InstanceTemplate
,
Lease
from
storage.models
import
Disk
from
storage.models
import
Disk
from
firewall.models
import
Vlan
from
firewall.models
import
Vlan
...
@@ -185,3 +185,20 @@ class VmDetailTest(TestCase):
...
@@ -185,3 +185,20 @@ class VmDetailTest(TestCase):
InstanceTemplate
.
objects
.
get
(
id
=
1
)
.
set_level
(
self
.
u1
,
'user'
)
InstanceTemplate
.
objects
.
get
(
id
=
1
)
.
set_level
(
self
.
u1
,
'user'
)
response
=
c
.
post
(
'/dashboard/template/1/'
,
{})
response
=
c
.
post
(
'/dashboard/template/1/'
,
{})
self
.
assertEqual
(
response
.
status_code
,
403
)
self
.
assertEqual
(
response
.
status_code
,
403
)
def
test_permitted_lease_delete
(
self
):
c
=
Client
()
self
.
login
(
c
,
'superuser'
)
leases
=
Lease
.
objects
.
count
()
response
=
c
.
post
(
"/dashboard/lease/delete/1/"
)
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
,
302
)
self
.
assertEqual
(
leases
,
Lease
.
objects
.
count
())
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