Fix tests and formatting
This commit is contained in:
parent
42970ded6f
commit
46cd8f3762
@ -1,6 +1,13 @@
|
||||
from wtforms.fields import BooleanField, DecimalField, FieldList, FileField, FormField, StringField
|
||||
from wtforms.fields import (
|
||||
BooleanField,
|
||||
DecimalField,
|
||||
FieldList,
|
||||
FileField,
|
||||
FormField,
|
||||
StringField,
|
||||
)
|
||||
from wtforms.fields.html5 import DateField
|
||||
from wtforms.validators import Required, Optional
|
||||
from wtforms.validators import Required
|
||||
from flask_wtf.file import FileAllowed
|
||||
from flask_wtf import FlaskForm
|
||||
|
||||
|
@ -130,9 +130,7 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
||||
return {
|
||||
"portfolio_name": self.portfolio_name,
|
||||
"pdf": self.pdf,
|
||||
"clins": [
|
||||
clin.to_dictionary() for clin in self.clins
|
||||
],
|
||||
"clins": [clin.to_dictionary() for clin in self.clins],
|
||||
**{
|
||||
c.name: getattr(self, c.name)
|
||||
for c in self.__table__.columns
|
||||
|
@ -13,9 +13,7 @@ def render_task_orders_edit(portfolio_id, task_order_id=None, form=None):
|
||||
|
||||
if task_order_id:
|
||||
task_order = TaskOrders.get(task_order_id)
|
||||
render_args["form"] = form or TaskOrderForm(
|
||||
**task_order.to_dictionary()
|
||||
)
|
||||
render_args["form"] = form or TaskOrderForm(**task_order.to_dictionary())
|
||||
render_args["task_order_id"] = task_order_id
|
||||
else:
|
||||
render_args["form"] = form or TaskOrderForm()
|
||||
|
@ -14,6 +14,6 @@ export default {
|
||||
},
|
||||
|
||||
data: function() {
|
||||
return {clinIndex: this.initialClinIndex}
|
||||
return { clinIndex: this.initialClinIndex }
|
||||
},
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ export default {
|
||||
initialyear: { type: String },
|
||||
mindate: { type: String },
|
||||
maxdate: { type: String },
|
||||
nameTag: { type: String }
|
||||
nameTag: { type: String },
|
||||
},
|
||||
|
||||
data: function() {
|
||||
|
@ -30,8 +30,6 @@ export default {
|
||||
clins,
|
||||
clinIndex,
|
||||
}
|
||||
// pass initialCLINIndex in props and add one each time a clin is added...
|
||||
// this way we can keep track of the clin id for the html name/id/etc
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
@ -55,7 +55,7 @@ def test_all_sections_complete():
|
||||
assert TaskOrders.all_sections_complete(task_order)
|
||||
|
||||
|
||||
def test_create_adds_clins():
|
||||
def test_create_adds_clins(pdf_upload):
|
||||
portfolio = PortfolioFactory.create()
|
||||
clins = [
|
||||
{
|
||||
@ -80,11 +80,12 @@ def test_create_adds_clins():
|
||||
portfolio_id=portfolio.id,
|
||||
number="0123456789",
|
||||
clins=clins,
|
||||
pdf=pdf_upload,
|
||||
)
|
||||
assert len(task_order.clins) == 2
|
||||
|
||||
|
||||
def test_update_adds_clins():
|
||||
def test_update_adds_clins(pdf_upload):
|
||||
task_order = TaskOrderFactory.create(number="1231231234")
|
||||
to_number = task_order.number
|
||||
clins = [
|
||||
@ -110,12 +111,13 @@ def test_update_adds_clins():
|
||||
portfolio_id=task_order.portfolio_id,
|
||||
number="0000000000",
|
||||
clins=clins,
|
||||
pdf=pdf_upload,
|
||||
)
|
||||
assert task_order.number != to_number
|
||||
assert len(task_order.clins) == 2
|
||||
|
||||
|
||||
def test_update_does_not_duplicate_clins():
|
||||
def test_update_does_not_duplicate_clins(pdf_upload):
|
||||
task_order = TaskOrderFactory.create(number="3453453456", clins=["123", "456"])
|
||||
clins = [
|
||||
{
|
||||
@ -136,7 +138,7 @@ def test_update_does_not_duplicate_clins():
|
||||
},
|
||||
]
|
||||
task_order = TaskOrders.update(
|
||||
task_order_id=task_order.id, number="0000000000", clins=clins
|
||||
task_order_id=task_order.id, number="0000000000", clins=clins, pdf=pdf_upload
|
||||
)
|
||||
assert len(task_order.clins) == 2
|
||||
for clin in task_order.clins:
|
||||
|
Loading…
x
Reference in New Issue
Block a user