Skip to content
This repository was archived by the owner on Feb 3, 2024. It is now read-only.

Commit c7b01b6

Browse files
authored
Merge pull request #321 from mboot-github/master
sync to dynamic tests
2 parents fdde1a6 + b943d44 commit c7b01b6

File tree

4 files changed

+47
-39
lines changed

4 files changed

+47
-39
lines changed

test3.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#! /usr/bin/env python3
2+
3+
from whois.main import main
4+
5+
main()

testAll.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212

1313
# all tld's that produce no output (None), we also show the raw try data
1414

15-
./test2.py -a 2>2 | tee 1
15+
./test3.py -V | tee 1
16+
./test3.py -a 2>2 | tee -a 1

testdata/DOMAINS.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
example.com # has iana source
2+
example.net # has iana source
3+
example.org # has no iana source
4+
hello.xyz # has sometimes IANA Source beginning on mac
5+
meta.co.jp # jp has [registrar] type keywords not registrar:
6+
meta.com # have emails
7+
meta.com.tr # has utf 8 response text and different formatting style
8+
meta.co.uk # has multiline for all relevant fields and 4 nameservers; should be fixed output has only 2
9+
meta.jp # jp has [registrar] type keywords not registrar:
10+
meta.kr # has both korean and english text
11+
xs4all.nl # has multiline nameserver and multiline registrar; outout has no nameservers should be 2

testdata/make_testdata.sh

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
11
#! /usr/bin/bash
22

3+
WHERE=$( dirname $0 )
4+
35
getDomains()
46
{
5-
DOMAINS=(
6-
example.net # has iana source
7-
example.com # has iana source
8-
example.org # has no iana source
9-
meta.co.uk # has multiline for all relevant fields and 4 nameservers; should be fixed output has only 2
10-
xs4all.nl # has multiline nameserver and multiline registrar; outout has no nameservers should be 2
11-
meta.com.sg # has mail
12-
meta.com # have emails
13-
meta.jp # jp has [registrar] type keywords not registrar:
14-
meta.co.jp # jp has [registrar] type keywords not registrar:
15-
meta.kr # has both korean and english text
16-
meta.com.tr # has utf 8 response text and different formatting style
17-
hello.xyz # has sometimes IANA Source beginning on mac
18-
)
7+
cat DOMAINS.txt |
8+
awk '
9+
/^[ \t]*;/ { next }
10+
/^[ \t]*#/ { next }
11+
/^[ \t]*$/ { next }
12+
{ print $1 }
13+
'
1914
}
2015

2116
verifyNameservers()
2217
{
2318
local str="$1"
2419

25-
grep name_servers "./$str/output" | awk '{ $1 = $2 = ""; print }' | awk -F, '{print NF}'
26-
grep "name server" "./$str/nameservers" | wc -l
20+
grep name_servers "./$str/output" |
21+
awk '{ $1 = $2 = ""; print }' |
22+
awk -F, '{print NF}'
2723

24+
grep "name server" "./$str/nameservers" |
25+
wc -l
2826
}
27+
2928
makeDataForDomain()
3029
{
3130
local str="$1"
@@ -38,7 +37,7 @@ makeDataForDomain()
3837
tee "./$str/input"
3938

4039
# dump the expected output as output
41-
../test2.py -d "$str" |
40+
../bin/test2.py -d "$str" |
4241
tee "./$str/output"
4342

4443
# dump the nameservers via host
@@ -48,31 +47,23 @@ makeDataForDomain()
4847
# verifyNameservers "$str"
4948
}
5049

51-
makeDataIfNotExist()
50+
main()
5251
{
53-
for str in ${DOMAINS[@]}
54-
do
55-
[ -d "$str" ] && continue
56-
makeDataForDomain "$str"
57-
done
58-
}
52+
local force="$1"
5953

60-
makeDataIfExist()
61-
{
62-
for str in ${DOMAINS[@]}
54+
cd "${WHERE}"
55+
getDomains |
56+
while read str
6357
do
64-
makeDataForDomain "$str"
65-
done
66-
}
58+
[ "$force" == "force" ] && {
59+
makeDataForDomain "$str"
60+
continue
61+
}
6762

68-
main()
69-
{
70-
local force="$1"
71-
getDomains
72-
makeDataIfNotExist
73-
[ "$force" == "force" ] && {
74-
makeDataIfExist
75-
}
63+
[ ! -d "$str" ] && {
64+
makeDataForDomain "$str"
65+
}
66+
done
7667
}
7768

7869
main $*

0 commit comments

Comments
 (0)