Skip to content

Commit afa29f0

Browse files
committed
main now has --whoisOnly and --rdapOnly for testing it
1 parent fed70f1 commit afa29f0

3 files changed

Lines changed: 22 additions & 6 deletions

File tree

Makefile.tests

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ TEST_OPTIONS_ALL = \
1212
# --------------------------------------------------
1313
# Tests
1414
# --------------------------------------------------
15-
test: prep test1 test2 test3 test4
15+
# test: prep test1 test2 test3 test4
16+
test: prep test2
1617

1718
prep:
1819
mkdir -p tmp
@@ -26,7 +27,7 @@ test1:
2627
test2:
2728
$(COMMON_VENV) \
2829
$(PIP_INSTALL) -r requirements.txt; \
29-
./test2.py -f testdata/DOMAINS.txt 2>tmp/$@.2 | tee tmp/$@.1
30+
./test2.py --whoisOnly -f testdata/DOMAINS.txt 2>tmp/$@.2 | tee tmp/$@.1;
3031

3132
# test3 simulates the whoisdomain command and has no data type in the output
3233
test3:

whoisdomain/context/parameterContext.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@
137137
"default": false,
138138
"optional": true,
139139
"help": "if set to true we skip the strip www action"
140-
}
140+
},
141141
"rdapOnly": {
142142
"type": "bool",
143143
"default": false,
144144
"optional": true,
145145
"help": "if set to true we only consult rdap"
146-
}
146+
},
147147
"whoisOnly": {
148148
"type": "bool",
149149
"default": false,

whoisdomain/main.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
WithStripHttpStatus: bool = False
3636
WithNoIgnoreWww: bool = False
3737

38+
RdapOnly: bool = False
39+
WhoisOnly: bool = False
40+
3841

3942
class ResponseCleaner:
4043
data: str
@@ -235,7 +238,9 @@ def testItem1(
235238
WithPublicSuffix, \
236239
WithExtractServers, \
237240
WithStripHttpStatus, \
238-
WithNoIgnoreWww
241+
WithNoIgnoreWww, \
242+
RdapOnly, \
243+
WhoisOnly
239244

240245
pc = whois.ParameterContext(
241246
ignore_returncode=IgnoreReturncode,
@@ -248,6 +253,8 @@ def testItem1(
248253
extractServers=WithExtractServers,
249254
stripHttpStatus=WithStripHttpStatus,
250255
noIgnoreWww=WithNoIgnoreWww,
256+
whoisOnly=WhoisOnly,
257+
rdapOnly=RdapOnly,
251258
)
252259

253260
# use the new query (can also simply use q2()
@@ -540,7 +547,7 @@ def showFailures() -> None:
540547

541548

542549
def main() -> None: # noqa: C901,PLR0915
543-
global PrintJson, Verbose, IgnoreReturncode, PrintGetRawWhoisResult, Ruleset, SIMPLISTIC, WithRedacted, TestAllTld, TestRunOnly, WithPublicSuffix, WithExtractServers, WithStripHttpStatus, WithNoIgnoreWww # noqa: E501 # pylint: disable=line-too-long
550+
global PrintJson, Verbose, IgnoreReturncode, PrintGetRawWhoisResult, Ruleset, SIMPLISTIC, WithRedacted, TestAllTld, TestRunOnly, WithPublicSuffix, WithExtractServers, WithStripHttpStatus, WithNoIgnoreWww, RdapOnly, WhoisOnly # noqa: E501 # pylint: disable=line-too-long
544551

545552
name: str = pathlib.Path(sys.argv[0]).name
546553
SIMPLISTIC = True
@@ -573,6 +580,8 @@ def main() -> None: # noqa: C901,PLR0915
573580
"extractServers",
574581
"stripHttpStatus",
575582
"withNoIgnoreWww",
583+
"rdapOnly",
584+
"whoisOnly",
576585
],
577586
)
578587
except getopt.GetoptError:
@@ -697,6 +706,12 @@ def main() -> None: # noqa: C901,PLR0915
697706
if opt in ("--withNoIgnoreWww"):
698707
WithNoIgnoreWww = True
699708

709+
if opt in ("--rdapOnly"):
710+
RdapOnly = True
711+
712+
if opt in ("--whoisOnly"):
713+
WhoisOnly = True
714+
700715
msg = f"{name} SIMPLISTIC: {SIMPLISTIC}"
701716
log.debug(msg)
702717

0 commit comments

Comments
 (0)