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
b36dc101
authored
Mar 10, 2014
by
Bach Dániel
4
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: update change_password tests
parent
f2ad812f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletions
+16
-1
circle/dashboard/tests/test_views.py
+16
-1
No files found.
circle/dashboard/tests/test_views.py
View file @
b36dc101
...
...
@@ -7,6 +7,7 @@ from vm.models import Instance, InstanceTemplate, Lease, Node
from
..models
import
Profile
from
storage.models
import
Disk
from
firewall.models
import
Vlan
from
mock
import
Mock
class
LoginMixin
(
object
):
...
...
@@ -17,9 +18,10 @@ class LoginMixin(object):
class
VmDetailTest
(
LoginMixin
,
TestCase
):
fixtures
=
[
'test-vm-fixture.json'
]
fixtures
=
[
'test-vm-fixture.json'
,
'node.json'
]
def
setUp
(
self
):
Instance
.
get_remote_queue_name
=
Mock
(
return_value
=
'test'
)
self
.
u1
=
User
.
objects
.
create
(
username
=
'user1'
)
self
.
u1
.
set_password
(
'password'
)
self
.
u1
.
save
()
...
...
@@ -111,6 +113,19 @@ class VmDetailTest(LoginMixin, TestCase):
response
=
c
.
post
(
'/dashboard/vm/mass-delete/'
,
{
'vms'
:
[
1
]})
self
.
assertEqual
(
response
.
status_code
,
302
)
def
test_permitted_password_change
(
self
):
c
=
Client
()
self
.
login
(
c
,
"user2"
)
inst
=
Instance
.
objects
.
get
(
pk
=
1
)
inst
.
set_level
(
self
.
u2
,
'owner'
)
inst
.
node
=
Node
.
objects
.
all
()[
0
]
inst
.
save
()
password
=
inst
.
pw
response
=
c
.
post
(
"/dashboard/vm/1/"
,
{
'change_password'
:
True
})
self
.
assertTrue
(
Instance
.
get_remote_queue_name
.
called
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertNotEqual
(
password
,
Instance
.
objects
.
get
(
pk
=
1
)
.
pw
)
def
test_unpermitted_password_change
(
self
):
c
=
Client
()
self
.
login
(
c
,
"user2"
)
...
...
Bach Dániel
@bachdaniel
mentioned in issue
#98 (closed)
Mar 10, 2014
mentioned in issue
#98 (closed)
mentioned in issue #98
Toggle commit list
Bach Dániel
@bachdaniel
mentioned in issue
#98 (closed)
Mar 10, 2014
mentioned in issue
#98 (closed)
mentioned in issue #98
Toggle commit list
Bach Dániel
@bachdaniel
mentioned in issue
#98 (closed)
Mar 14, 2014
mentioned in issue
#98 (closed)
mentioned in issue #98
Toggle commit list
Bach Dániel
@bachdaniel
mentioned in issue
#98 (closed)
Mar 15, 2014
mentioned in issue
#98 (closed)
mentioned in issue #98
Toggle commit list
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