Repository: eve-val/evelink

Issue:
kills() uses KillLog rather than KillMails
KillLog is a long cache endpoint, so you can only query it once.

KillMails isn't a long cache, so you can query it as often as you want.

Discussion:

Patch:
diff --git a/evelink/char.py b/evelink/char.py
index 609d76d..0514dc6 100644
--- a/evelink/char.py
+++ b/evelink/char.py
@@ -137,7 +137,7 @@ class Char(object):
         """Get a list of PI routing entries for a character's planet."""
         return api.APIResult(parse_planetary_routes(api_result.result), api_result.timestamp, api_result.expires)
 
-    @auto_call('char/KillLog', map_params={'before_kill': 'beforeKillID'})
+    @auto_call('char/KillMails', map_params={'before_kill': 'beforeKillID'})
     def kills(self, before_kill=None, api_result=None):
         """Look up recent kills for a character.
 
@@ -147,6 +147,19 @@ class Char(object):
 
         return api.APIResult(parse_kills(api_result.result), api_result.timestamp, api_result.expires)
 
+    @auto_call('char/KillLog', map_params={'before_kill': 'beforeKillID'})
+    def kill_log(self, before_kill=None, api_result=None):
+        """Look up recent kills for a character.
+
+        Note: this method uses the long cache version of the endpoint. If you
+              want to use the short cache version (recommended), use kills().
+
+        before_kill:
+            Optional. Only show kills before this kill id. (Used for paging.)
+        """
+
+        return api.APIResult(parse_kills(api_result.result), api_result.timestamp, api_result.expires)
+
     @auto_call('char/Notifications')
     def notifications(self, api_result=None):
         """Returns the message headers for notifications."""
diff --git a/evelink/corp.py b/evelink/corp.py
index 5e98fcc..ebf1133 100644
--- a/evelink/corp.py
+++ b/evelink/corp.py
@@ -136,7 +136,7 @@ class Corp(object):
 
         return api.APIResult(results, api_result.timestamp, api_result.expires)
 
-    @api.auto_call('corp/KillLog', map_params={'before_kill': 'beforeKillID'})
+    @api.auto_call('corp/KillMails', map_params={'before_kill': 'beforeKillID'})
     def kills(self, before_kill=None, api_result=None):
         """Look up recent kills for a corporation.
 
@@ -146,6 +146,19 @@ class Corp(object):
 
         return api.APIResult(parse_kills(api_result.result), api_result.timestamp, api_result.expires)
 
+    @api.auto_call('corp/KillLog', map_params={'before_kill': 'beforeKillID'})
+    def kill_log(self, before_kill=None, api_result=None):
+        """Look up recent kills for a corporation.
+
+        Note: this method uses the long cache version of the endpoint. If you
+              want to use the short cache version (recommended), use kills().
+
+        before_kill:
+            Optional. Only show kills before this kill id. (Used for paging.)
+        """
+
+        return api.APIResult(parse_kills(api_result.result), api_result.timestamp, api_result.expires)
+
     @api.auto_call('corp/AccountBalance')
     def wallet_info(self, api_result=None):
         """Get information about corp wallets."""


Test patch:
diff --git a/tests/test_char.py b/tests/test_char.py
index ca37666..64e3631 100644
--- a/tests/test_char.py
+++ b/tests/test_char.py
@@ -291,6 +291,23 @@ class CharTestCase(APITestCase):
         self.assertEqual(current, 12345)
         self.assertEqual(expires, 67890)
 
+        self.assertEqual(result, mock.sentinel.kills)
+        self.assertEqual(self.api.mock_calls, [
+                mock.call.get('char/KillMails', params={'characterID': 1}),
+            ])
+        self.assertEqual(mock_parse.mock_calls, [
+                mock.call(mock.sentinel.api_result),
+            ])
+
+    @mock.patch('evelink.char.parse_kills')
+    def test_kill_log(self, mock_parse):
+        self.api.get.return_value = API_RESULT_SENTINEL
+        mock_parse.return_value = mock.sentinel.kills
+
+        result, current, expires = self.char.kill_log()
+        self.assertEqual(current, 12345)
+        self.assertEqual(expires, 67890)
+
         self.assertEqual(result, mock.sentinel.kills)
         self.assertEqual(self.api.mock_calls, [
                 mock.call.get('char/KillLog', params={'characterID': 1}),
@@ -304,7 +321,7 @@ class CharTestCase(APITestCase):
 
         self.char.kills(before_kill=12345)
         self.assertEqual(self.api.mock_calls, [
-                mock.call.get('char/KillLog', params={'characterID': 1, 'beforeKillID': 12345}),
+                mock.call.get('char/KillMails', params={'characterID': 1, 'beforeKillID': 12345}),
             ])
 
     def test_character_sheet(self):
diff --git a/tests/test_corp.py b/tests/test_corp.py
index 0e96533..5738401 100644
--- a/tests/test_corp.py
+++ b/tests/test_corp.py
@@ -165,6 +165,23 @@ class CorpTestCase(APITestCase):
 
         result, current, expires = self.corp.kills()
 
+        self.assertEqual(result, mock.sentinel.kills)
+        self.assertEqual(self.api.mock_calls, [
+                mock.call.get('corp/KillMails', params={}),
+            ])
+        self.assertEqual(mock_parse.mock_calls, [
+                mock.call(mock.sentinel.api_result),
+            ])
+        self.assertEqual(current, 12345)
+        self.assertEqual(expires, 67890)
+
+    @mock.patch('evelink.corp.parse_kills')
+    def test_kill_log(self, mock_parse):
+        self.api.get.return_value = API_RESULT_SENTINEL
+        mock_parse.return_value = mock.sentinel.kills
+
+        result, current, expires = self.corp.kill_log()
+
         self.assertEqual(result, mock.sentinel.kills)
         self.assertEqual(self.api.mock_calls, [
                 mock.call.get('corp/KillLog', params={}),