def test_get_callbackip(self, mock_data): """Test get callback ip.""" access_token = 'access_token' mock_data.return_value = { 'ip_list': ['127.0.0.1', '127.0.0.1'] } resp = WechatAPI.get_callbackip(access_token) self.assertEqual(len(resp['ip_list']), 2)
def test_get_callbackip_failure(self): """Test.""" access_token = 'access_token' result = WechatAPI.get_callbackip(access_token) self.assertIn('errmsg', result) self.assertIn('requrl', result)