Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Nov 22, 2023
1 parent a7fc57e commit 33d1d9e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 316 deletions.
2 changes: 1 addition & 1 deletion .docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FROM base-$BUILDARCH as common
ARG AUTO_INIT=True

# System deps (bc + exiftool for testing)
RUN apt-get update && apt-get install -y python3 python3-pip python3-venv libpq-dev wget bc && apt-get clean
RUN apt-get update && apt-get install -y python3 python3-pip python3-venv libpq-dev wget bc exiftool && apt-get clean

# Python deps
# Python deps
Expand Down
29 changes: 16 additions & 13 deletions test/test_reordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,35 @@ def test_reorder_signs_in_rank(self):
)

row = {
"frame_fk_azimut": azimut_id,
"frame_rank": 1,
"frame_fk_frame_type": 1,
"frame_fk_frame_fixing_type": 1,
"frame_fk_status": 1,
"sign_rank": 1,
"fk_azimut": azimut_id,
"fk_frame_type": 1,
"fk_frame_fixing_type": 1,
"fk_status": 1,
}

frame_id = self.insert("frame", row)

row = {
"fk_frame": frame_id,
"fk_sign_type": 1,
"fk_official_sign": "1.01",
"fk_durability": 1,
"fk_status": 1,
"comment": "1",
}
sign_ids = [self.insert("vw_sign_symbol", row, schema="signalo_app")]
frame_id = self.select("sign", sign_ids[0])["fk_frame"]

row["frame_id"] = frame_id
row["fk_frame"] = frame_id
sign_ids = []

for i in range(2, 6):
row["sign_rank"] = i
for i in range(1, 6):
row["rank"] = i
row["comment"] = str(i)
sign_ids.append(self.insert("vw_sign_symbol", row, schema="signalo_app"))
sign_ids.append(self.insert("sign", row))

self.assertEqual(self.count("sign"), sign_count + 5)
self.assertEqual(self.count("frame"), frame_count + 1)

self.delete("vw_sign_symbol", sign_ids[1], schema="signalo_app")
self.delete("sign", sign_ids[1])

self.check({"rank": 1, "comment": "1"}, "sign", sign_ids[0])
self.check({"rank": 2, "comment": "3"}, "sign", sign_ids[2])
Expand Down
295 changes: 0 additions & 295 deletions test/test_view_sign_symbol.py

This file was deleted.

14 changes: 7 additions & 7 deletions test/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,27 @@ def update(self, table, row, id, schema="signalo_db"):
row,
)

def delete(self, table, id, schema="signalo_db"):
def delete(self, table, fid, schema="signalo_db"):
cur = self.conn.cursor()
cur.execute(
"DELETE FROM {schema}.{table} WHERE id=%s".format(
table=table, schema=schema
),
[id],
[fid],
)

def insert_check(self, table, row, expected_row=None, schema="signalo_db"):
id = self.insert(table, row, schema)
result = self.select(table, id, schema)
def insert_check(self, table, row, expected_row=None, schema="signalo_db") -> str:
fid = self.insert(table, row, schema)
result = self.select(table, fid, schema)

assert result, id
assert result, fid

if expected_row:
row = expected_row

self.check_result(row, result, table, "insert", schema)

return id
return fid

def update_check(self, table, row, id, schema="signalo_db"):
self.update(table, row, id, schema)
Expand Down

0 comments on commit 33d1d9e

Please sign in to comment.