Skip to content

Commit

Permalink
a test for 2-tuple using non-port local addr
Browse files Browse the repository at this point in the history
  • Loading branch information
meejah committed Sep 26, 2018
1 parent 803c675 commit cd3ffb7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/test_onion.py
Expand Up @@ -264,6 +264,23 @@ def test_ephemeral_v3_no_key(self):
self.assertEqual(u"ADD_ONION NEW:ED25519-V3 Port=80,127.0.0.1:80 Flags=Detach", cmd)
d.callback("PrivateKey={}\nServiceID={}".format(_test_private_key_blob, _test_onion_id))

def test_ephemeral_v3_ip_addr_tuple(self):
protocol = FakeControlProtocol([])
config = TorConfig(protocol)

# returns a Deferred we're ignoring
EphemeralOnionService.create(
Mock(),
config,
ports=[(80, "192.168.1.2:80")],
detach=True,
version=3,
)

cmd, d = protocol.commands[0]
self.assertEqual(u"ADD_ONION NEW:ED25519-V3 Port=80,192.168.1.2:80 Flags=Detach", cmd)
d.callback("PrivateKey={}\nServiceID={}".format(_test_private_key_blob, _test_onion_id))

@defer.inlineCallbacks
def test_ephemeral_v3_wrong_key_type(self):
protocol = FakeControlProtocol([])
Expand Down

0 comments on commit cd3ffb7

Please sign in to comment.