-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add test database in scripts - Modify travis conf to use test database
- Loading branch information
1 parent
8decac5
commit ac78523
Showing
4 changed files
with
23 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
DATABASE_URL=postgresql://open_event_user:opev_pass@127.0.0.1:5432/oevent | ||
DATABASE_URL=postgresql://open_event_user:opev_pass@localhost:5432/oevent | ||
INTEGRATE_SOCKETIO=false | ||
TEST_DATABASE_URL=postgresql://open_event_user:[email protected]:5432/opev_test | ||
TEST_DATABASE_URL=postgresql://open_event_user:opev_pass@localhost:5432/opev_test | ||
|
||
# If using fast docker test DB, uncomment following line | ||
# TEST_DATABASE_URL=postgresql://test:test@localhost:5433/test | ||
|
||
APP_CONFIG=config.DevelopmentConfig | ||
|
||
POSTGRES_USER=open_event_user | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,23 +224,21 @@ python manage.py module -n all -s off | |
|
||
#### Running unit tests | ||
|
||
* Open Event uses Postgres database for testing. So set `DATABASE_URL` as a postgres database. Here is an example. | ||
* If you have docker installed and want to run tests faster, run | ||
|
||
```sh | ||
export DATABASE_URL=postgresql://test_user:[email protected]:5432/opev_test | ||
# format is postgresql://USERNAME:PASSWORD@ADDRESS/DATABASE_NAME | ||
export APP_CONFIG=config.TestingConfig | ||
```shell script | ||
./scripts/test_db.sh | ||
``` | ||
|
||
* Then go to the project directory and run the following command: | ||
``` | ||
python3 -m unittest discover tests/ | ||
And set appropriate value of `TEST_DATABASE` in `.env` | ||
|
||
```shell script | ||
TEST_DATABASE_URL=postgresql://test:test@localhost:5433/test | ||
``` | ||
* It will run each test one by one. | ||
|
||
* You can also use the following command to run tests using nosetests: | ||
* Then go to the project directory and run the following command: | ||
``` | ||
nosetests tests/ | ||
pytest tests/ | ||
``` | ||
|
||
#### Running robot framework tests | ||
|
@@ -283,7 +281,7 @@ We have the following branches : | |
* **development** | ||
All development goes on in this branch. If you're making a contribution, please make a pull request to _development_. | ||
All PRs must pass a build check and a unit-test check on Travis (https://open-event-api-dev.herokuapp.com - Is running off of the development branch. It is hosted on Heroku.) | ||
|
||
* **master** | ||
This contains shipped code. After significant features/bug-fixes are accumulated on development, we make a version update and make a release. (https://api.eventyay.com - Is running off of the `master` branch. Hosted on Google Cloud Platform (Google Container Engine + Kubernetes).) | ||
* **gh-pages** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
docker run -d -e POSTGRES_PASSWORD=test -e POSTGRES_USER=test \ | ||
--mount type=tmpfs,destination=/var/lib/postgresql/data \ | ||
--rm -p 5433:5432 --name opev-test-db postgis/postgis:12-3.0-alpine |