Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Adam Osuchowski
Kea
Commits
6e4caf9d
Commit
6e4caf9d
authored
Jan 07, 2013
by
JINMEI Tatuya
Browse files
[2437] use a string for the default of test find_result.
it's probably more intuitive than False.
parent
fb10ec4e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/dns/python/tests/zone_checker_python_test.py
View file @
6e4caf9d
...
@@ -119,17 +119,18 @@ class ZoneCheckerTest(unittest.TestCase):
...
@@ -119,17 +119,18 @@ class ZoneCheckerTest(unittest.TestCase):
# This is the Python-only collection class. Its find() makes
# This is the Python-only collection class. Its find() makes
# the check pass by default, by returning hardcoded RRsets.
# the check pass by default, by returning hardcoded RRsets.
# If raise_on_find is set to True, find() raises an exception.
# If raise_on_find is set to True, find() raises an exception.
# If find_result is set to something other than False, find()
# If find_result is set to something other than 'use_default'
# returns that specified value.
# (as a string), find() returns that specified value (note that
# it can be None).
def
__init__
(
self
,
raise_on_find
=
False
,
find_result
=
False
):
def
__init__
(
self
,
raise_on_find
=
False
,
find_result
=
'use_default'
):
self
.
__raise_on_find
=
raise_on_find
self
.
__raise_on_find
=
raise_on_find
self
.
__find_result
=
find_result
self
.
__find_result
=
find_result
def
find
(
self
,
name
,
rrclass
,
rrtype
):
def
find
(
self
,
name
,
rrclass
,
rrtype
):
if
self
.
__raise_on_find
:
if
self
.
__raise_on_find
:
raise
FakeException
(
'find error'
)
raise
FakeException
(
'find error'
)
if
self
.
__find_result
is
not
False
:
if
self
.
__find_result
is
not
'use_default'
:
return
self
.
__find_result
return
self
.
__find_result
if
rrtype
==
RRType
.
SOA
():
if
rrtype
==
RRType
.
SOA
():
soa
=
RRset
(
Name
(
'example'
),
RRClass
.
IN
(),
rrtype
,
soa
=
RRset
(
Name
(
'example'
),
RRClass
.
IN
(),
rrtype
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment