-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathft_bestwhois.sh
executable file
·63 lines (62 loc) · 2.46 KB
/
ft_bestwhois.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
#Some simple test cases for the bestwhois command-line tool
#Part of the bestwhois utility, (c) WhoisXML API, Inc.
ERRORCOUNT=0
#Basic tests
echo "Test No. 1"
./bestwhois domainwhoisdatabase.com --text --strippedrawtext
RETCODE=$?
if [[ $RETCODE != 0 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
echo "Test No. 2"
./bestwhois --history domainwhoisdatabase.com --expired-date-to 2017-01-01
RETCODE=$?
if [[ $RETCODE != 0 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
#Empty result set, history
echo "Test No. 3"
./bestwhois domainwhoisdatabase.com --expired-date-from 2040-01-01
RETCODE=$?
if [[ $RETCODE != 2 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
#bad API key
echo "Test No. 4"
./bestwhois google.com --text --history --fullrawtext --apikey foo
RETCODE=$?
#Invalid domain name
echo "Test No. 5"
./bestwhois foobar
RETCODE=$?
if [[ $RETCODE != 2 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
echo "Test No. 6"
./bestwhois foobar --history
RETCODE=$?
if [[ $RETCODE != 2 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
echo "Test No. 7"
./bestwhois domainwhoisdatabase.com --created-date-from 2000-01-01 --created-date-to 2016-01-01
RETCODE=$?
if [[ $RETCODE != 0 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
# Combinations of date limitations
echo "Test No. 8"
./bestwhois domainwhoisdatabase.com --updated-date-from 2000-01-01 --updated-date-to 2016-01-01
RETCODE=$?
if [[ $RETCODE != 0 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
echo "Test No. 9"
./bestwhois domainwhoisdatabase.com --updated-date-from 2000-01-01 --created-date-to 2016-01-01
RETCODE=$?
if [[ $RETCODE != 0 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
echo "Test No. 10"
./bestwhois domainwhoisdatabase.com --created-date-from 2000-01-01 --expired-date-to 2014-01-01
RETCODE=$?
if [[ $RETCODE != 2 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
echo "Test No. 11"
./bestwhois domainwhoisdatabase.com --created-date-from 2000-01-01 --expired-date-to 2020-01-01
RETCODE=$?
if [[ $RETCODE != 0 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
echo "Test No. 12"
./bestwhois domainwhoisdatabase.com --expired-date-from 2000-01-01 --expired-date-to 2018-01-01
RETCODE=$?
if [[ $RETCODE != 0 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
echo "Test No. 13"
./bestwhois москва.рф
RETCODE=$?
if [[ $RETCODE != 0 ]];then echo "ERROR";let ERRORCOUNT++;else echo "OK";fi
#Reporting error count
echo "ERROR COUNT: $ERRORCOUNT"