Skip to content

Commit

Permalink
Merge pull request City-of-Helsinki#192 from City-of-Helsinki/feature…
Browse files Browse the repository at this point in the history
…-document-testing

Add instructions how to configure database for tests
  • Loading branch information
Rikuoja authored Mar 8, 2017
2 parents 566eeb9 + 2793b90 commit 3c8a46e
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,31 @@ After this, everything but search endpoint (/search) is working. See [search](#s
Running tests
------------
Tests must be run using an user who can create (and drop) databases and write the directories
your linkedevents installation resides in.
your linkedevents installation resides in. Also the template database must include Postgis and
HSTORE-extensions. If you are developing, you probably want to give those
permissions to the database user configured in your development instance. Like so:

```bash
# Change this if you have different DB user
DATABASE_USER=linkedevents
# Most likely you have a postgres system user that can log into postgres as DB postgres user
sudo -u postgres psql << EOF
ALTER USER "$DATABASE_USER" CREATEDB;
\c template1
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS hstore;
EOF

```

Afterwards you can run the tests:
```bash
cd $INSTALL_BASE/linkedevents
py.test events
```

Note that search tests will fail unless you configure [search](#search)

Requirements
------------

Expand Down

0 comments on commit 3c8a46e

Please sign in to comment.