Skip to content

Commit

Permalink
i
Browse files Browse the repository at this point in the history
  • Loading branch information
tlocke committed Aug 3, 2023
1 parent ebe66ac commit b883d97
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions chellow/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5026,6 +5026,7 @@ def get_by_name(sess, name):
def insert(sess, name, properties):
scenario = Scenario(name, properties)
sess.add(scenario)
sess.flush()
return scenario

__tablename__ = "scenario"
Expand Down
1 change: 1 addition & 0 deletions chellow/reports/report_59.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,7 @@ def do_post(sess):

now = utc_datetime_now()
args = props, base_name, g.user.id, compression, now, False
sess.rollback()
thread = threading.Thread(target=content, args=args)
thread.start()
return chellow_redirect("/downloads", 303)
Expand Down
6 changes: 4 additions & 2 deletions test/reports/test_report_59.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import odio


from utils import match

from chellow.models import (
Expand Down Expand Up @@ -53,7 +54,6 @@ def test_do_post_scenario(mocker, sess, client):
"site_codes": ["CI017"],
}
scenario = Scenario.insert(sess, "test", scenario_props)
sess.commit()

mock_Thread = mocker.patch("chellow.reports.report_59.threading.Thread")

Expand All @@ -67,6 +67,7 @@ def test_do_post_scenario(mocker, sess, client):
"compression": compression,
}

sess.commit()
response = client.post("/reports/59", data=data)

match(response, 303)
Expand Down Expand Up @@ -393,6 +394,7 @@ def displaced_virtual_bill(ds):

editor = UserRole.insert(sess, "editor")
user = User.insert(sess, "admin@example.com", "xxx", editor, None)
user_id = user.id

sess.commit()

Expand Down Expand Up @@ -425,7 +427,7 @@ def displaced_virtual_bill(ds):
content(
scenario_props,
base_name,
user.id,
user_id,
compression,
now,
is_bill_check,
Expand Down

0 comments on commit b883d97

Please sign in to comment.