|
16 | 16 | from z3c.relationfield import RelationValue
|
17 | 17 | from zope.component import getUtility
|
18 | 18 | from zope.intid.interfaces import IIntIds
|
| 19 | +from zope.lifecycleevent import ObjectModifiedEvent |
| 20 | +from zope.event import notify |
19 | 21 |
|
20 | 22 | import unittest
|
21 | 23 |
|
@@ -432,3 +434,19 @@ def test_venue_serializers(self):
|
432 | 434 | if item["id"] in ["venue1", "venue2"]:
|
433 | 435 | self.assertEqual(item["geolocation"]["latitude"], 44.35)
|
434 | 436 | self.assertEqual(item["geolocation"]["longitude"], 11.7)
|
| 437 | + |
| 438 | + def test_venue_history_return_right_data(self): |
| 439 | + venue = api.content.create(container=self.portal, type="Venue", title="venue1") |
| 440 | + venue.description = "aaa" |
| 441 | + notify(ObjectModifiedEvent(venue)) |
| 442 | + venue.description = "aaa bbb" |
| 443 | + notify(ObjectModifiedEvent(venue)) |
| 444 | + commit() |
| 445 | + |
| 446 | + response0 = self.api_session.get(f"{venue.absolute_url()}/@history/0").json() |
| 447 | + response1 = self.api_session.get(f"{venue.absolute_url()}/@history/1").json() |
| 448 | + response2 = self.api_session.get(f"{venue.absolute_url()}/@history/2").json() |
| 449 | + |
| 450 | + self.assertEqual(response0["description"], "") |
| 451 | + self.assertEqual(response1["description"], "aaa") |
| 452 | + self.assertEqual(response2["description"], "aaa bbb") |
0 commit comments