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
33c336cb
authored
Apr 10, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add tests to group creation - namecollision, ownerchecking
parent
7c53fbd9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
circle/dashboard/tests/test_views.py
+21
-0
No files found.
circle/dashboard/tests/test_views.py
View file @
33c336cb
...
@@ -541,9 +541,12 @@ class GroupCreateTest(LoginMixin, TestCase):
...
@@ -541,9 +541,12 @@ class GroupCreateTest(LoginMixin, TestCase):
self
.
us
=
User
.
objects
.
create
(
username
=
'superuser'
,
is_superuser
=
True
)
self
.
us
=
User
.
objects
.
create
(
username
=
'superuser'
,
is_superuser
=
True
)
self
.
us
.
set_password
(
'password'
)
self
.
us
.
set_password
(
'password'
)
self
.
us
.
save
()
self
.
us
.
save
()
self
.
g1
=
Group
.
objects
.
create
(
name
=
'group1'
)
self
.
g1
.
save
()
def
tearDown
(
self
):
def
tearDown
(
self
):
super
(
GroupCreateTest
,
self
)
.
tearDown
()
super
(
GroupCreateTest
,
self
)
.
tearDown
()
self
.
g1
.
delete
()
self
.
u0
.
delete
()
self
.
u0
.
delete
()
self
.
u1
.
delete
()
self
.
u1
.
delete
()
self
.
us
.
delete
()
self
.
us
.
delete
()
...
@@ -602,6 +605,24 @@ class GroupCreateTest(LoginMixin, TestCase):
...
@@ -602,6 +605,24 @@ class GroupCreateTest(LoginMixin, TestCase):
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
response
.
status_code
,
302
)
self
.
assertEqual
(
Group
.
objects
.
count
(),
groupnum
+
1
)
self
.
assertEqual
(
Group
.
objects
.
count
(),
groupnum
+
1
)
def
test_namecollision_group_create
(
self
):
# hint: group1 is in setUp, the tests checks creating group with the
# same name
c
=
Client
()
groupnum
=
Group
.
objects
.
count
()
self
.
login
(
c
,
'superuser'
)
response
=
c
.
post
(
'/dashboard/group/create/'
,
{
'name'
:
'group1'
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
Group
.
objects
.
count
(),
groupnum
)
def
test_creator_is_owner_when_group_create
(
self
):
# has owner rights in the group the user who created the group?
c
=
Client
()
self
.
login
(
c
,
'user0'
)
c
.
post
(
'/dashboard/group/create/'
,
{
'name'
:
'newgroup'
})
newgroup
=
Group
.
objects
.
get
(
name
=
'newgroup'
)
self
.
assertTrue
(
newgroup
.
profile
.
has_level
(
self
.
u0
,
'owner'
))
class
GroupDetailTest
(
LoginMixin
,
TestCase
):
class
GroupDetailTest
(
LoginMixin
,
TestCase
):
fixtures
=
[
'test-vm-fixture.json'
,
'node.json'
]
fixtures
=
[
'test-vm-fixture.json'
,
'node.json'
]
...
...
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