Skip to content

Commit

Permalink
adding test for callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
frankstratton committed Apr 19, 2013
1 parent f8edbca commit 71f5875
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/server/test_tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,25 @@ def test_get_by_hostname(self):
tunnel.destroy()

Tunnel.domain_suffix = None

def test_tunnel_callbacks(self):
Tunnel.domain_suffix = 'bar'
self.create_called = False
self.destroy_called = False

def create_callback(tunnel):
self.assertEquals(tunnel.name, "foo")
self.create_called = True

def destroy_callback(tunnel):
self.assertEquals(tunnel.name, "foo")
self.destroy_called = True

Tunnel.create_callback = create_callback
Tunnel.destroy_callback = destroy_callback

tunnel = Tunnel.create(dict(name='foo', client='Test-Client'))
tunnel.destroy()

self.assertTrue(self.create_called)
self.assertTrue(self.destroy_called)

0 comments on commit 71f5875

Please sign in to comment.