Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Pole-Web
Website
Commits
2f4a7017
Commit
2f4a7017
authored
Nov 27, 2020
by
VAN ZUIJLEN Nils
Browse files
Code style
parent
e57045c5
Changes
2
Hide whitespace changes
Inline
Side-by-side
boutique/tests/test_views.py
View file @
2f4a7017
...
...
@@ -406,7 +406,7 @@ class OrderEditViewTest(OrderItemTestCase):
@
user_logged_in
def
test_context_data_user
(
self
)
->
None
:
url
=
reverse
(
'
boutique:order_edit
'
)
url
=
reverse
(
"
boutique:order_edit
"
)
# Empty order
resp
=
self
.
client
.
get
(
url
)
...
...
@@ -449,12 +449,14 @@ class OrderEditViewTest(OrderItemTestCase):
self
.
assertIn
(
"total_price"
,
context
)
self
.
assertIn
(
"is_contributor"
,
context
)
self
.
assertEqual
(
context
[
"total_price"
],
cotiz
.
price_contributor
+
item
.
price_contributor
)
self
.
assertEqual
(
context
[
"total_price"
],
cotiz
.
price_contributor
+
item
.
price_contributor
)
self
.
assertTrue
(
context
[
"is_contributor"
])
@
contrib_user_logged_in
def
test_context_data_contrib_user
(
self
)
->
None
:
url
=
reverse
(
'
boutique:order_edit
'
)
url
=
reverse
(
"
boutique:order_edit
"
)
# Empty order
resp
=
self
.
client
.
get
(
url
)
...
...
@@ -497,7 +499,9 @@ class OrderEditViewTest(OrderItemTestCase):
self
.
assertIn
(
"total_price"
,
context
)
self
.
assertIn
(
"is_contributor"
,
context
)
self
.
assertEqual
(
context
[
"total_price"
],
cotiz
.
price_contributor
+
item
.
price_contributor
)
self
.
assertEqual
(
context
[
"total_price"
],
cotiz
.
price_contributor
+
item
.
price_contributor
)
self
.
assertTrue
(
context
[
"is_contributor"
])
...
...
boutique/views.py
View file @
2f4a7017
...
...
@@ -323,9 +323,10 @@ class OrderEditView(LoginRequiredMixin, UpdateView):
self
.
object
.
compute_price
()
kwargs
[
"total_price"
]
=
self
.
object
.
price
kwargs
[
"is_contributor"
]
=
bde
.
models
.
Contributor
.
is_contributor
(
self
.
request
.
user
)
or
self
.
object
.
contains_cotiz
kwargs
[
"is_contributor"
]
=
(
bde
.
models
.
Contributor
.
is_contributor
(
self
.
request
.
user
)
or
self
.
object
.
contains_cotiz
)
return
kwargs
...
...
Write
Preview
Supports
Markdown
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