1
0
mirror of https://github.com/hasura/graphql-engine.git synced 2024-12-20 05:51:54 +03:00
graphql-engine/server/tests-py/test_version.py
Brandon Simmons bc4456eccc Add local development swiss army knife script scripts/dev.sh
At the moment we can...

...run tests in isolation, generating coverage report:

    $ dev.sh test

You can pass args to pytest as well. e.g. to run a specific test:

    $ dev.sh test -k "test_jsonb_has_all"

Launch a postgres container with useful dev defaults, with PostGIS,
cleaning up afterwards:

    $ dev.sh postgres

Build and launch graphql-engine in dev mode, connecting with a
`postgres` launched above

    $ dev.sh graphql-engine
2019-07-26 01:17:35 -04:00

19 lines
630 B
Python

#!/usr/bin/env python3
import pytest
import re
class TestServerVersion(object):
def test_version(self, hge_ctx):
resp = hge_ctx.http.get(
hge_ctx.hge_url + '/v1/version'
)
my_json = resp.json()
# The tree may be dirty because we're developing tests locally while
# graphql-engine was built previously when tree was clean. If we're
# modifying graphql-engine too then both of these will be tagged dirty,
# since a rebuild would necessarily be forced:
assert my_json['version'] in (hge_ctx.version, re.sub('-dirty$', '', hge_ctx.version)), my_json