Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
etch
nuages
Commits
2aa64cde
Commit
2aa64cde
authored
Jun 22, 2015
by
Christophe Siraut
Browse files
tests: start telling user stories
parent
269961b8
Changes
2
Hide whitespace changes
Inline
Side-by-side
meetingpoll/test_functional.py
View file @
2aa64cde
...
...
@@ -11,23 +11,44 @@ class MeetingPoll(WebTest):
self
.
poll
=
pollFactory
()
def
test_is_displayed
(
self
):
# Mary got a poll URL
# She can successfully open it
response
=
self
.
app
.
get
(
self
.
poll
.
link
)
self
.
assertEqual
(
response
.
status_code
,
200
)
# There is a form displayed waiting for her to answer
self
.
assertTrue
(
'form'
in
response
.
context
)
self
.
assertEqual
(
response
.
context
[
'object'
].
id
,
self
.
poll
.
id
)
def
test_404
(
self
):
# Test random URL failing
response
=
self
.
app
.
get
(
'/%s/'
%
createId
(
5
),
status
=
404
)
self
.
assertEqual
(
response
.
status_code
,
404
)
def
test_creation
(
self
):
def
test_poll_creation
(
self
):
# Gerald wants to create a poll
# He forget to fill the form title
new
=
self
.
app
.
get
(
reverse
(
'new'
))
form
=
new
.
forms
[
0
]
form
[
'description'
]
=
'fake description'
edition
=
form
.
submit
()
self
.
assertContains
(
edition
,
'Manage choices'
,
count
=
0
,
status_code
=
200
)
self
.
assertContains
(
edition
,
'This field is required'
,
count
=
1
,
status_code
=
200
)
# He then fills the poll form
new
=
self
.
app
.
get
(
reverse
(
'new'
))
form
=
new
.
forms
[
0
]
form
[
'title'
]
=
'fake title'
form
[
'description'
]
=
'fake description'
edition
=
form
.
submit
().
follow
()
self
.
assertContains
(
edition
,
'Manage choices'
,
count
=
1
,
status_code
=
200
)
self
.
assertContains
(
edition
,
'Manage choices'
,
count
=
1
,
status_code
=
200
)
form
=
edition
.
forms
[
0
]
form
[
'choice_set-0-choice_0'
]
=
'06/06/2013 17:00'
form
[
'choice_set-0-details'
]
=
'fake detail'
...
...
nuages/test_functional.py
View file @
2aa64cde
...
...
@@ -34,6 +34,8 @@ class LoginProcess(WebTest):
class
HomePage
(
WebTest
):
def
test_is_responding
(
self
):
# Carol heard about Nuages
# She opens her browser and open its homepage
home
=
self
.
app
.
get
(
reverse
(
'home'
))
assert
home
.
status_code
==
200
assert
'Nuages - Easy poll sharing'
in
home
.
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