Skip to content

Commit

Permalink
Merge pull request #55 from lsst-dm/tickets/DM-47125
Browse files Browse the repository at this point in the history
DM-47125 Add unit test for ccdexposure insert with multi-column primary keys
  • Loading branch information
bbrondel authored Nov 14, 2024
2 parents 8e1f5fc + 077a9a5 commit 801263b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Dockerfile.pytest
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG OBS_LSST_VERSION=w_2024_32
ARG OBS_LSST_VERSION=w_2024_46
FROM lsstsqre/centos:7-stack-lsst_distrib-${OBS_LSST_VERSION}
USER root

Expand Down
44 changes: 44 additions & 0 deletions tests/test_pqserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,50 @@ def test_schema_table(lsstcomcamsim, astropy_tables):
assert column in result.keys()


@pytest.mark.parametrize("lsstcomcamsim", ["cdb_latiss"], indirect=True)
def test_missing_primary_key(lsstcomcamsim):
client = lsstcomcamsim

response = client.post(
"/consdb/insert/latiss/exposure/obs/2024032100003",
json={
"values": {
"exposure_name": "AT_O_20240327_000002",
"controller": "O",
"day_obs": 20240327,
"seq_num": 2,
},
},
)
_assert_http_status(response, 200)
result = response.json()
assert result == {
"message": "Data inserted",
"table": "cdb_latiss.exposure",
"instrument": "latiss",
"obs_id": 2024032100003,
}

response = client.post(
"/consdb/insert/latiss/ccdexposure/obs/8675309",
json={
"values": {
"s_region": "testregion",
"exposure_id": 2024032100003,
"detector": 0,
},
},
)
_assert_http_status(response, 200)
result = response.json()
assert result == {
"message": "Data inserted",
"table": "cdb_latiss.ccdexposure",
"instrument": "latiss",
"obs_id": 8675309,
}


def test_validate_unit():
os.environ["POSTGRES_URL"] = "sqlite://"
from lsst.consdb import pqserver
Expand Down

0 comments on commit 801263b

Please sign in to comment.