1 #!/bin/bash
2
3 seedJson=$(pwd)/$1
4
5 res=$(curl -s 'http://localhost:9000/store/products' | \
6 python3 -c "
7
8 import sys, json;
9
10 loadedProducts = json.load(sys.stdin)['products'];
11
12 seededProducts = json.load(open(\""$seedJson"\"))['products'];
13
14 result = set([product['title'] for product in loadedProducts]) == set([product['title'] for product in seededProducts])
15
16 print(result)
17 ")
18
19 if [[ "$res" != "True" ]] ; then
20 echo "Seed failed, products are not equal"
21 exit 1
22 else
23 exit 0
24 fi