← Back to team overview

zeitgeist team mailing list archive

[Branch ~zeitgeist/zeitgeist/bluebird] Rev 304: Add one more test

 

------------------------------------------------------------
revno: 304
committer: Michal Hruby <michal.mhr@xxxxxxxxx>
branch nick: bluebird
timestamp: Wed 2011-10-12 21:20:10 +0200
message:
  Add one more test
modified:
  test/dbus/remote-test.py


--
lp:~zeitgeist/zeitgeist/bluebird
https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird

Your team Zeitgeist Framework Team is subscribed to branch lp:~zeitgeist/zeitgeist/bluebird.
To unsubscribe from this branch go to https://code.launchpad.net/~zeitgeist/zeitgeist/bluebird/+edit-subscription
=== modified file 'test/dbus/remote-test.py'
--- test/dbus/remote-test.py	2011-09-18 12:54:07 +0000
+++ test/dbus/remote-test.py	2011-10-12 19:20:10 +0000
@@ -149,6 +149,36 @@
 						num_events=10)
 		self.assertEquals(1, len(ids))
 
+	def testFindOneOfThreeEvents(self):
+		events = parse_events("test/data/three_events.js")
+		ids = self.insertEventsAndWait(events)
+		self.assertEquals(3, len(ids))
+		
+		events = self.getEventsAndWait(ids)
+		self.assertEquals(3, len(events))
+		for event in events:
+			self.assertTrue(isinstance(event, Event))
+			self.assertEquals(Manifestation.USER_ACTIVITY, event.manifestation)
+			self.assertTrue(event.actor.startswith("Boogaloo"))
+		
+		# Search for everything
+		ids = self.findEventIdsAndWait([], num_events=3)
+		self.assertEquals(3, len(ids))
+		
+		# Search for some specific templates
+		subj_templ1 = Subject.new_for_values(interpretation="!"+Interpretation.AUDIO)
+		subj_templ2 = Subject.new_for_values(interpretation="!"+Interpretation.IMAGE)
+		event_template = Event.new_for_values(
+					actor="Boogaloo*",
+					interpretation=Interpretation.ACCESS_EVENT,
+					subjects=[subj_templ1, subj_templ2])
+		ids = self.findEventIdsAndWait([event_template],
+						num_events=10)
+		self.assertEquals(1, len(ids))
+		events = self.getEventsAndWait(ids)
+		event = events[0]
+		self.assertEquals(event.subjects[0].interpretation, Interpretation.DOCUMENT)
+
 	def testFindEventsWithMultipleSubjects(self):
 		events = parse_events("test/data/three_events.js")
 		ids = self.insertEventsAndWait(events)