]> gitweb.michael.orlitzky.com - dead/htsn-import.git/blob - test/shell/import-duplicates.test
Complete TSN.XML.AutoRacingDriverList.
[dead/htsn-import.git] / test / shell / import-duplicates.test
1 #
2 # Attempt to import our test XML twice; all attempts after the first
3 # should fail.
4 #
5
6 # First, we remove any leftover mess.
7 rm -f shelltest.sqlite3
8 >>>= 0
9
10 # Now we run the import/migrate silently.
11 ./dist/build/htsn-import/htsn-import -c 'shelltest.sqlite3' test/xml/*.xml > /dev/null
12 >>>= 0
13
14 # We note the number of XML files that we have. There's one extra
15 # Heartbeat.xml that doesn't really count. There are also 2 weatherxml
16 # and a newsxml that aren't really supposed to import.
17 find ./test/xml -maxdepth 1 -name '*.xml' | wc -l
18 >>>
19 40
20 >>>= 0
21
22 # Run the imports again; we should get complaints about the duplicate
23 # xml_file_ids. There are 2 errors for each violation, so we expect
24 # (twice the number of files) occurrences of the string 'ERROR'. Oh
25 # and we subtract 2 because 2 of the files are supposed to fail. I
26 # know, sorry.
27 ./dist/build/htsn-import/htsn-import -c 'shelltest.sqlite3' test/xml/*.xml 2>&1 | grep ERROR | wc -l
28 >>>
29 72
30 >>>= 0
31
32 # Finally, clean up after ourselves.
33 rm -f shelltest.sqlite3
34 >>>= 0