2013-04-01 23:02:24 +02:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
function migration_status {
|
|
|
|
./manage.py migrate --list | sed 's/*/ /' > "$1"
|
|
|
|
}
|
2013-03-05 23:08:55 +01:00
|
|
|
|
|
|
|
if [ -e zephyr/tests/zephyrdb.test.pristine ]; then
|
2013-04-01 23:02:24 +02:00
|
|
|
migration_status zephyr/fixtures/available-migrations
|
|
|
|
if [ -e zephyr/fixtures/migration-status ] &&
|
|
|
|
cmp -s zephyr/fixtures/available-migrations zephyr/fixtures/migration-status &&
|
|
|
|
[ "$1" != "--force" ]; then
|
2013-03-05 23:08:55 +01:00
|
|
|
cp zephyr/tests/zephyrdb.test.pristine zephyr/tests/zephyrdb.test
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2012-09-04 22:31:56 +02:00
|
|
|
mkdir -p zephyr/fixtures
|
2012-10-11 00:12:27 +02:00
|
|
|
rm -f zephyr/tests/zephyrdb.test
|
2013-03-05 23:08:55 +01:00
|
|
|
rm -f zephyr/tests/zephyrdb.test.pristine
|
2013-01-10 22:58:01 +01:00
|
|
|
|
|
|
|
# Remove time.pyc to try to prevent it from screwing people importing
|
|
|
|
# time from inside zephyr.lib. We can drop this hack after a bit.
|
|
|
|
rm -f zephyr/lib/time.pyc
|
|
|
|
|
2012-10-11 00:10:48 +02:00
|
|
|
python manage.py syncdb --noinput --settings=humbug.test_settings
|
2013-01-09 18:16:07 +01:00
|
|
|
python manage.py migrate --settings=humbug.test_settings --all
|
2013-04-01 23:02:24 +02:00
|
|
|
migration_status "zephyr/fixtures/migration-status"
|
|
|
|
|
2013-01-08 21:59:52 +01:00
|
|
|
# This next line can be simplified to "-n0" once we fix our app with 0 messages.
|
|
|
|
python manage.py populate_db --settings=humbug.test_settings --test-suite -n2 \
|
|
|
|
--threads=1 --huddles=0 --personals=0 --percent-huddles=0 --percent-personals=0
|
2012-10-25 06:11:28 +02:00
|
|
|
python manage.py dumpdata --settings=humbug.test_settings \
|
2013-04-04 19:02:47 +02:00
|
|
|
zephyr.UserProfile zephyr.Stream zephyr.Recipient \
|
2012-10-25 06:11:28 +02:00
|
|
|
zephyr.Subscription zephyr.Message zephyr.Huddle zephyr.Realm \
|
2012-11-27 18:26:51 +01:00
|
|
|
zephyr.UserMessage zephyr.Client \
|
|
|
|
zephyr.DefaultStream > zephyr/fixtures/messages.json
|
2013-03-05 23:08:55 +01:00
|
|
|
|
|
|
|
cp zephyr/tests/zephyrdb.test zephyr/tests/zephyrdb.test.pristine
|