Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
AE
Sith
Commits
0a9eb2fd
Commit
0a9eb2fd
authored
Dec 29, 2016
by
Skia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix club tests
parent
fbb41c3c
Pipeline
#662
passed with stage
in 3 minutes and 19 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
8 deletions
+32
-8
club/tests.py
club/tests.py
+32
-8
No files found.
club/tests.py
View file @
0a9eb2fd
...
...
@@ -17,14 +17,20 @@ class ClubTest(TestCase):
def
test_create_add_user_to_club_from_root_ok
(
self
):
self
.
client
.
login
(
username
=
'root'
,
password
=
'plop'
)
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
skia
.
id
,
"role"
:
3
})
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
skia
.
id
,
"start_date"
:
"12/06/2016"
,
"role"
:
3
})
response
=
self
.
client
.
get
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}))
self
.
assertTrue
(
response
.
status_code
==
200
)
self
.
assertTrue
(
"S' Kia</a></td>
\\
n <td>Responsable info</td>"
in
str
(
response
.
content
))
def
test_create_add_user_to_club_from_root_fail_not_subscriber
(
self
):
self
.
client
.
login
(
username
=
'root'
,
password
=
'plop'
)
response
=
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
guy
.
id
,
"role"
:
3
})
response
=
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
guy
.
id
,
"start_date"
:
"12/06/2016"
,
"role"
:
3
})
self
.
assertTrue
(
response
.
status_code
==
200
)
self
.
assertTrue
(
'<ul class="errorlist nonfield"><li>'
in
str
(
response
.
content
))
response
=
self
.
client
.
get
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}))
...
...
@@ -32,27 +38,45 @@ class ClubTest(TestCase):
def
test_create_add_user_to_club_from_root_fail_already_in_club
(
self
):
self
.
client
.
login
(
username
=
'root'
,
password
=
'plop'
)
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
skia
.
id
,
"role"
:
3
})
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
skia
.
id
,
"start_date"
:
"12/06/2016"
,
"role"
:
3
})
response
=
self
.
client
.
get
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}))
self
.
assertTrue
(
"S' Kia</a></td>
\\
n <td>Responsable info</td>"
in
str
(
response
.
content
))
response
=
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
skia
.
id
,
"role"
:
4
})
response
=
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
skia
.
id
,
"start_date"
:
"12/06/2016"
,
"role"
:
4
})
self
.
assertTrue
(
response
.
status_code
==
200
)
self
.
assertFalse
(
"S' Kia</a></td>
\\
n <td>Secrétaire</td>"
in
str
(
response
.
content
))
def
test_create_add_user_to_club_from_skia_ok
(
self
):
self
.
client
.
login
(
username
=
'root'
,
password
=
'plop'
)
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
skia
.
id
,
"role"
:
10
})
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
skia
.
id
,
"start_date"
:
"12/06/2016"
,
"role"
:
10
})
self
.
client
.
login
(
username
=
'skia'
,
password
=
'plop'
)
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
rbatsbak
.
id
,
"role"
:
9
})
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
rbatsbak
.
id
,
"start_date"
:
"12/06/2016"
,
"role"
:
9
})
response
=
self
.
client
.
get
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}))
self
.
assertTrue
(
response
.
status_code
==
200
)
self
.
assertTrue
(
"""Richard Batsbak</a></td>
\\
n <td>Vice-Pr
\\
xc3
\\
xa9sident</td>"""
in
str
(
response
.
content
))
def
test_create_add_user_to_club_from_richard_fail
(
self
):
self
.
client
.
login
(
username
=
'root'
,
password
=
'plop'
)
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
rbatsbak
.
id
,
"role"
:
3
})
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
rbatsbak
.
id
,
"start_date"
:
"12/06/2016"
,
"role"
:
3
})
self
.
client
.
login
(
username
=
'rbatsbak'
,
password
=
'plop'
)
response
=
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
skia
.
id
,
"role"
:
10
})
response
=
self
.
client
.
post
(
reverse
(
"club:club_members"
,
kwargs
=
{
"club_id"
:
self
.
bdf
.
id
}),
{
"user"
:
self
.
skia
.
id
,
"start_date"
:
"12/06/2016"
,
"role"
:
10
})
self
.
assertTrue
(
response
.
status_code
==
200
)
self
.
assertTrue
(
"<li>Vous n'avez pas la permission de faire cela</li>"
in
str
(
response
.
content
))
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