2017-12-08 11:29:37 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -ev
|
2018-01-06 19:53:48 +01:00
|
|
|
export DJANGO_SETTINGS_MODULE="zproject.slack_importer_test_settings"
|
2017-12-08 11:29:37 +01:00
|
|
|
|
2018-01-06 19:53:48 +01:00
|
|
|
psql -h localhost postgres zulip_test <<EOF
|
|
|
|
DROP DATABASE IF EXISTS zulip_slack_importer_test;
|
|
|
|
CREATE DATABASE zulip_slack_importer_test TEMPLATE zulip_test_template;
|
|
|
|
EOF
|
|
|
|
|
2018-01-20 14:49:40 +01:00
|
|
|
sudo apt-get install unzip zip
|
|
|
|
|
2018-01-06 19:53:48 +01:00
|
|
|
./manage.py migrate --noinput
|
2018-01-20 14:49:40 +01:00
|
|
|
pwd=$(pwd)
|
2018-01-06 19:53:48 +01:00
|
|
|
wget https://github.com/houstondatavis/slack-export/archive/master.zip -O /tmp/slack-export-master.zip
|
2018-01-20 14:49:40 +01:00
|
|
|
cd /tmp
|
|
|
|
unzip -q /tmp/slack-export-master.zip
|
|
|
|
cd /tmp/slack-export-master/
|
|
|
|
zip -r -q slack-export-master.zip .
|
|
|
|
cd $pwd
|
|
|
|
./manage.py convert_slack_data /tmp/slack-export-master/slack-export-master.zip "slack-importer-test-realm" --output /tmp/slack_importer_test_data
|
|
|
|
rm -rf /tmp/slack-export-master
|
|
|
|
./manage.py import --import-into-nonempty /tmp/slack_importer_test_data
|