本文整理匯總了Python中ripe.atlas.tools.commands.probe_search.Command.build_request_args方法的典型用法代碼示例。如果您正苦於以下問題:Python Command.build_request_args方法的具體用法?Python Command.build_request_args怎麽用?Python Command.build_request_args使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ripe.atlas.tools.commands.probe_search.Command
的用法示例。
在下文中一共展示了Command.build_request_args方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_sane_tags
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_sane_tags(self):
"""Sane tags"""
cmd = Command()
cmd.init_args(["--tag", "native-ipv6"])
self.assertEquals(
cmd.build_request_args(),
{"tags": "native-ipv6"}
)
cmd = Command()
cmd.init_args(["--tag", "native-ipv6", "--tag", "system-ipv4-works"])
self.assertEquals(
cmd.build_request_args(),
{"tags": "native-ipv6,system-ipv4-works"}
)
示例2: test_center_arg
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_center_arg(self):
"""User passed center arg"""
cmd = Command()
cmd.init_args(["--center", "1,2"])
self.assertEquals(
cmd.build_request_args(),
{"radius": "1,2:15"}
)
示例3: test_location_arg
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_location_arg(self):
"""User passed location arg"""
with mock.patch('requests.get') as mock_get:
mock_get.return_value = requests.Response()
with mock.patch('requests.Response.json') as mock_json:
mock_json.return_value = {"results": [
{"geometry": {"location": {"lat": 1, "lng": 2}}}]}
cmd = Command()
cmd.init_args(["--location", "blaaaa"])
self.assertEquals(cmd.build_request_args(), {'radius': '1,2:15'})
示例4: test_sane_args1
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_sane_args1(self):
"""User passed several arguments (1)"""
cmd = Command()
cmd.init_args([
"--center", "1,2",
"--radius", "4",
"--asnv4", "3333",
"--prefix", "193.0.0.0/21"
])
self.assertEquals(
cmd.build_request_args(),
{'asn_v4': 3333, 'prefix': '193.0.0.0/21', 'radius': '1,2:4'}
)
示例5: test_sane_args3
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_sane_args3(self):
"""User passed several arguments (3)"""
cmd = Command()
cmd.init_args([
"--center", "1,2",
"--asnv6", "3333",
"--prefixv6", "2001:67c:2e8::/48"
])
self.assertEquals(cmd.build_request_args(), {
'asn_v6': 3333,
'prefix_v6': '2001:67c:2e8::/48',
'radius': '1,2:15'
})
示例6: test_sane_args2
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_sane_args2(self):
"""User passed several arguments (2)"""
cmd = Command()
cmd.init_args([
"--location", "Amsterdam",
"--asn", "3333",
"--prefixv4", "193.0.0.0/21"
])
path = '{}.Command.location2degrees'.format(COMMAND_MODULE)
with mock.patch(path) as mock_get:
mock_get.return_value = (1, 2)
self.assertEquals(cmd.build_request_args(), {
'asn': 3333,
'prefix_v4': '193.0.0.0/21',
'radius': '1,2:15'
})
示例7: test_status_arg
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_status_arg(self):
"""User passed valid status arg."""
for status in range(0, 3):
cmd = Command()
cmd.init_args(["--status", str(status)])
self.assertEquals(cmd.build_request_args(), {"status": status})
示例8: test_country_arg_with_radius
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_country_arg_with_radius(self):
"""User passed country code arg together with radius"""
cmd = Command()
cmd.init_args(["--country", "GR", "--radius", "4"])
self.assertEquals(cmd.build_request_args(), {"country_code": "GR"})
示例9: test_country_arg
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_country_arg(self):
"""User passed country code arg"""
cmd = Command()
cmd.init_args(["--country", "GR"])
self.assertEquals(cmd.build_request_args(), {"country_code": "GR"})
示例10: test_center_arg_with_radius
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_center_arg_with_radius(self):
"""User passed center and radius arg"""
cmd = Command()
cmd.init_args(["--center", "1,2", "--radius", "4"])
self.assertEquals(cmd.build_request_args(), {"radius": "1,2:4"})
示例11: test_all_args
# 需要導入模塊: from ripe.atlas.tools.commands.probe_search import Command [as 別名]
# 或者: from ripe.atlas.tools.commands.probe_search.Command import build_request_args [as 別名]
def test_all_args(self):
"""User passed all arguments"""
cmd = Command()
cmd.init_args(["--all"])
self.assertEquals(cmd.build_request_args(), {})