Fix tests in order to run with PostgreSQL

Most of the issues are caused by the use of SQLAlchemy database session. Some
inline comments describe the issues in detail.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>
This commit is contained in:
Chenxiong Qi
2019-06-27 12:12:50 +08:00
parent 302c76b90f
commit e49f69f7b5
18 changed files with 758 additions and 634 deletions

View File

@@ -121,10 +121,11 @@ class TestDecisionUpdateHandler:
clean_database()
# This build should be queried and transformed to ready state
module_build = make_module("pkg:0.1:1:c1", requires_list={"platform": "el8"})
module_build = make_module(db.session, "pkg:0.1:1:c1", requires_list={"platform": "el8"})
module_build.transition(
conf, BUILD_STATES["done"], "Move to done directly for running test."
)
db.session.commit()
# Assert this call below
first_publish_call = call(
@@ -134,8 +135,6 @@ class TestDecisionUpdateHandler:
conf=conf,
)
db.session.refresh(module_build)
ClientSession.return_value.getBuild.return_value = {
"extra": {"typeinfo": {"module": {"module_build_service_id": module_build.id}}}
}