This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix broken tests and run tests in a Docker container on Travis CI.
* Add `docker-compose.travis.yml` and `icekit/bin/runtests.sh`. * Assume database name has been set correctly already in test settings module. * Install missing `fluent_pages.pagetypes.fluentpage` app, which is needed by tests. * Ensure `polymorphic_auth` is near the top of `INSTALLED_APPS` because it monkey patches Django's `get_user_model()` and some other Django auth code had already imported it before the monkey patch was applied. * Use `G()` from DDF to create test users to avoid unique constraint violations. * Update reversed URLs for renamed app labels. * Make authenticated requests when testing admin pages, to avoid errors on 302 status code instead of expected 200 status code. * Add a database dump to bypass migrations and speed up tests.
- Loading branch information
Showing
7 changed files
with
8,405 additions
and
29 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
django: | ||
command: runtests.sh | ||
environment: | ||
BASE_SETTINGS_MODULE: docker | ||
PGHOST: postgres | ||
PGUSER: postgres | ||
TRAVIS: | ||
image: interaction/icekit:latest | ||
links: | ||
- elasticsearch | ||
- postgres | ||
- redis | ||
volumes: | ||
- ./:/opt/django-icekit | ||
elasticsearch: | ||
image: interaction/elasticsearch-icu:1 | ||
postgres: | ||
image: onjin/alpine-postgres:9.4 | ||
redis: | ||
command: redis-server --appendonly yes | ||
image: redis:3-alpine |
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,17 @@ | ||
#!/bin/bash | ||
|
||
# Run tests. | ||
|
||
cat <<EOF | ||
# `whoami`@`hostname`:$PWD$ runtests.sh $@ | ||
EOF | ||
|
||
set -e | ||
|
||
export BASE_SETTINGS_MODULE=test | ||
export PGDATABASE="${PGDATABASE:-test_icekit}" | ||
export REUSE_DB=1 | ||
export FORCE_SETUP_POSTGRES_DATABASE=1 | ||
export SRC_PGDATABASE=test_icekit.sql | ||
|
||
exec entrypoint.sh bash -c "manage.py collectstatic --noinput --verbosity=0 && manage.py compress --verbosity=0 && manage.py test --noinput --verbosity=2 $@" |
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
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
Oops, something went wrong.