Permalink
Browse files

Testes automatizados para a classe ``utils.sync.datacollector.Changes…

…List``
  • Loading branch information...
1 parent 3edbf65 commit d30d8c01d40968a23824fb7673ea7c22a579612c @gustavofonseca committed Mar 7, 2013
Showing with 32 additions and 2 deletions.
  1. +32 −2 opac/utils/tests/tests_datacollector.py
View
34 opac/utils/tests/tests_datacollector.py
@@ -1,6 +1,5 @@
# coding: utf-8
import mocker
-from django.test.utils import override_settings
from catalog.test import modelfactories
@@ -475,7 +474,6 @@ class ChangesListTests(mocker.MockerTestCase):
def test_type_is_checked_at_instantiation(self):
from utils.sync.datacollector import ChangesList
-
self.assertRaises(TypeError, lambda: ChangesList('must fail'))
def test_raw_data_from_scielo_api_is_accepted_on_instantiation(self):
@@ -782,6 +780,38 @@ def test_unique_records_from_different_endpoints_doesnt_clash(self):
self.assertEqual(changes[0].seq, 2)
self.assertEqual(changes[1].seq, 3)
+ def test_last_seq(self):
+ from utils.sync.datacollector import ChangesList
+ changes = [
+ {
+ "changed_at": "2013-01-23T15:12:33.409478",
+ "collection_uri": "/api/v1/collections/2/",
+ "event_type": "added",
+ "object_uri": "/api/v1/journals/1/",
+ "resource_uri": "/api/v1/changes/1/",
+ "seq": 1
+ },
+ {
+ "changed_at": "2013-01-23T15:12:33.409478",
+ "collection_uri": "/api/v1/collections/2/",
+ "event_type": "added",
+ "object_uri": "/api/v1/journals/2/",
+ "resource_uri": "/api/v1/changes/2/",
+ "seq": 2
+ },
+ {
+ "changed_at": "2013-01-23T15:11:33.409478",
+ "collection_uri": "/api/v1/collections/1/",
+ "event_type": "updated",
+ "object_uri": "/api/v1/journals/1/",
+ "resource_uri": "/api/v1/changes/8/",
+ "seq": 3
+ }
+ ]
+
+ ch_list = ChangesList(changes)
+ self.assertEqual(ch_list.last_seq, 3)
+
class ChangesListIteratorTests(mocker.MockerTestCase):

0 comments on commit d30d8c0

Please sign in to comment.