def test_get(self): """ Ensure that the node's get method works as expected. """ drog = Drogulus(PRIVATE_KEY, PUBLIC_KEY, self.event_loop, self.connector) result = asyncio.Future() drog._node.retrieve = MagicMock(return_value=result) pending_result = drog.get(PUBLIC_KEY, 'foo') expected = construct_key(PUBLIC_KEY, 'foo') drog._node.retrieve.assert_called_once_with(expected) self.assertEqual(result, pending_result)
def test_get(self): """ Ensure that the node's get method works as expected. """ drog = Drogulus(PRIVATE_KEY, PUBLIC_KEY, self.event_loop, self.connector) result = asyncio.Future() drog._node.retrieve = MagicMock(return_value=result) pending_result = drog.get(PUBLIC_KEY, 'foo') expected = construct_key(PUBLIC_KEY, 'foo') drog._node.retrieve.assert_called_once_with(expected) self.assertEqual(result, pending_result)
def test_whois(self): """ Check that the whois method makes the appropriate request to the wider network. """ drog = Drogulus(PRIVATE_KEY, PUBLIC_KEY, self.event_loop, self.connector) result = asyncio.Future() drog.get = MagicMock(return_value=result) pending_result = drog.whois(PUBLIC_KEY) drog.get.assert_called_once_with(PUBLIC_KEY, PUBLIC_KEY) self.assertEqual(result, pending_result)
def test_whois(self): """ Check that the whois method makes the appropriate request to the wider network. """ drog = Drogulus(PRIVATE_KEY, PUBLIC_KEY, self.event_loop, self.connector) result = asyncio.Future() drog.get = MagicMock(return_value=result) pending_result = drog.whois(PUBLIC_KEY) drog.get.assert_called_once_with(PUBLIC_KEY, PUBLIC_KEY) self.assertEqual(result, pending_result)