-
Notifications
You must be signed in to change notification settings - Fork 8
/
test.sh
executable file
·63 lines (55 loc) · 1.93 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
export FOOBAR="_build/foobar"
assertEqual() {
if [[ "$1" == "$2" ]];
then echo ".";
else
echo "$1"
echo "$2"
echo "F";
exit 1;
fi
}
assertCheckoutMigration() {
pushd $FOOBAR
git checkout "$1"
OUT=`echo ".schema baz_foo" | python manage.py dbshell`
assertEqual "$OUT" "$2"
popd
}
syncdb() {
pushd $FOOBAR
python manage.py syncdb --migrate --noinput
popd
}
clean() {
rm -rf _build/foobar/
}
extract_test_repo() {
pushd _build
tar -xzf foobar.tar.gz
popd
}
install_compass() {
pip install -e .
pushd $FOOBAR
django-south-compass install
popd
}
clean
extract_test_repo
install_compass
syncdb
# master => id, name
# branch1 => id, name, bar1
# branch2 => id, name, bar2
assertCheckoutMigration branch1 'CREATE TABLE "baz_foo" ("bar1" varchar(20) NULL, "id" integer PRIMARY KEY, "name" varchar(20) NOT NULL);'
assertCheckoutMigration master 'CREATE TABLE "baz_foo" ("id" integer PRIMARY KEY, "name" varchar(20) NOT NULL);'
assertCheckoutMigration branch2 'CREATE TABLE "baz_foo" ("bar2" varchar(20) NULL, "id" integer PRIMARY KEY, "name" varchar(20) NOT NULL);'
assertCheckoutMigration master 'CREATE TABLE "baz_foo" ("id" integer PRIMARY KEY, "name" varchar(20) NOT NULL);'
assertCheckoutMigration branch1 'CREATE TABLE "baz_foo" ("bar1" varchar(20) NULL, "id" integer PRIMARY KEY, "name" varchar(20) NOT NULL);'
assertCheckoutMigration branch2 'CREATE TABLE "baz_foo" ("bar2" varchar(20) NULL, "id" integer PRIMARY KEY, "name" varchar(20) NOT NULL);'
assertCheckoutMigration branch1 'CREATE TABLE "baz_foo" ("bar1" varchar(20) NULL, "id" integer PRIMARY KEY, "name" varchar(20) NOT NULL);'
assertCheckoutMigration branch2 'CREATE TABLE "baz_foo" ("bar2" varchar(20) NULL, "id" integer PRIMARY KEY, "name" varchar(20) NOT NULL);'
assertCheckoutMigration master 'CREATE TABLE "baz_foo" ("id" integer PRIMARY KEY, "name" varchar(20) NOT NULL);'
clean