From 7b54ca5640a39f204c0111b4eff404864a5392e0 Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Thu, 30 Sep 2021 22:30:23 +0200 Subject: [PATCH] TST: add tests for caosdb-server#183 --- .docker/Dockerfile | 4 ++-- .gitlab-ci.yml | 6 +----- tests/test_issues_server.py | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index baf80aa..2873d04 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -10,9 +10,9 @@ RUN apt-get update && \ -y COPY .docker/wait-for-it.sh /wait-for-it.sh ARG PYLIB=dev -ADD https://gitlab.com/api/v4/projects/13656973/repository/commits/${PYLIB} \ +ADD https://gitlab.indiscale.com/api/v4/projects/97/repository/commits/${PYLIB} \ pylib_version.json -RUN git clone https://gitlab.com/caosdb/caosdb-pylib.git && \ +RUN git clone https://gitlab.indiscale.com/caosdb/caosdb-pylib.git && \ cd caosdb-pylib && git checkout ${PYLIB} && pip3 install . COPY . /git diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2d4893..84f52f2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -158,10 +158,6 @@ build-testenv: image: docker:19.03 stage: setup timeout: 2h - only: - - schedules - - web - - pushes needs: [] script: - df -h @@ -169,7 +165,7 @@ build-testenv: - if [ -z "$PYLIB" ]; then if echo "$CI_COMMIT_REF_NAME" | grep -c "^f-" ; then echo "Check if pylib has branch $CI_COMMIT_REF_NAME" ; - if wget https://gitlab.com/api/v4/projects/13656973/repository/branches/${CI_COMMIT_REF_NAME} ; then + if wget https://gitlab.indiscale.com/api/v4/projects/97/repository/branches/${CI_COMMIT_REF_NAME} ; then PYLIB=$CI_COMMIT_REF_NAME ; fi; fi; diff --git a/tests/test_issues_server.py b/tests/test_issues_server.py index 4a42373..9c03edd 100644 --- a/tests/test_issues_server.py +++ b/tests/test_issues_server.py @@ -435,3 +435,19 @@ def test_issue_170(): p2 = db.execute_query("FIND TestProp3", unique=True) assert p2.datatype == db.LIST(db.INTEGER) assert p2.value == [1, 2] + + +def test_issue_183(): + """No reasonable error when using bad datetime format. + https://gitlab.indiscale.com/caosdb/src/caosdb-server/-/issues/183 + """ + + # Date YYYY-MM-ddThh:mm:ss + assert db.Property(name="TestDateTime", datatype=db.DATETIME, + value="2015-05-05T20:15:00").insert().id is not None + with pytest.raises(db.TransactionError) as cm: + # Date YYYY-MM-ddThh:mm + db.Property(name="TestDateTime2", datatype=db.DATETIME, + value="2015-05-05T20:15").insert() + assert cm.value.errors[0].msg == ("Cannot parse value to datetime format " + "(yyyy-mm-dd'T'hh:mm:ss[.fffffffff][TimeZone]).") -- GitLab