~jplacerda/zeitgeist/784850

« back to all changes in this revision

Viewing changes to test/remote-test.py

  • Committer: Mikkel Kamstrup Erlandsen
  • Date: 2010-04-28 19:11:01 UTC
  • mfrom: (1322.1.103 ontology_definition)
  • Revision ID: kamstrup@hardback-20100428191101-9pmau6vlqmna0fow
Merge lp:~zeitgeist/zeitgeist/ontology_definition. This introduces some slight API breaks on the Python level and maybe the need for a DB version upgrade to reflect new URIs here and there. We will tackle these issues in trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
        
26
26
        def testInsertAndGetEvent(self):
27
27
                ev = Event.new_for_values(timestamp=123,
28
 
                                        interpretation=Interpretation.VISIT_EVENT,
 
28
                                        interpretation=Interpretation.ACCESS_EVENT,
29
29
                                        manifestation=Manifestation.USER_ACTIVITY,
30
30
                                        actor="Freak Mamma")
31
31
                subj = Subject.new_for_values(uri="void://foobar",
32
32
                                        interpretation=Interpretation.DOCUMENT,
33
 
                                        manifestation=Manifestation.FILE)
 
33
                                        manifestation=Manifestation.FILE_DATA_OBJECT)
34
34
                ev.append_subject(subj)
35
35
                ids = self.insertEventsAndWait([ev])
36
36
                events = self.getEventsAndWait(ids)
40
40
                ev = events[0]
41
41
                self.assertTrue(isinstance(ev, Event))
42
42
                self.assertEquals("123", ev.timestamp)
43
 
                self.assertEquals(Interpretation.VISIT_EVENT, ev.interpretation)
 
43
                self.assertEquals(Interpretation.ACCESS_EVENT, ev.interpretation)
44
44
                self.assertEquals(Manifestation.USER_ACTIVITY, ev.manifestation)
45
45
                self.assertEquals("Freak Mamma", ev.actor)
46
46
                self.assertEquals(1, len(ev.subjects))
47
47
                self.assertEquals("void://foobar", ev.subjects[0].uri)
48
48
                self.assertEquals(Interpretation.DOCUMENT, ev.subjects[0].interpretation)
49
 
                self.assertEquals(Manifestation.FILE, ev.subjects[0].manifestation)
 
49
                self.assertEquals(Manifestation.FILE_DATA_OBJECT, ev.subjects[0].manifestation)
50
50
        
51
51
        def testFindTwoOfThreeEvents(self):
52
52
                ev1 = Event.new_for_values(timestamp=400,
53
 
                                        interpretation=Interpretation.VISIT_EVENT,
 
53
                                        interpretation=Interpretation.ACCESS_EVENT,
54
54
                                        manifestation=Manifestation.USER_ACTIVITY,
55
55
                                        actor="Boogaloo")       
56
56
                ev2 = Event.new_for_values(timestamp=500,
57
 
                                        interpretation=Interpretation.VISIT_EVENT,
 
57
                                        interpretation=Interpretation.ACCESS_EVENT,
58
58
                                        manifestation=Manifestation.USER_ACTIVITY,
59
59
                                        actor="Boogaloo")
60
60
                ev3 = Event.new_for_values(timestamp=600,
63
63
                                        actor="Boogaloo")
64
64
                subj1 = Subject.new_for_values(uri="foo://bar",
65
65
                                        interpretation=Interpretation.DOCUMENT,
66
 
                                        manifestation=Manifestation.FILE)
 
66
                                        manifestation=Manifestation.FILE_DATA_OBJECT)
67
67
                subj2 = Subject.new_for_values(uri="foo://baz",
68
68
                                        interpretation=Interpretation.IMAGE,
69
 
                                        manifestation=Manifestation.FILE)
 
69
                                        manifestation=Manifestation.FILE_DATA_OBJECT)
70
70
                subj3 = Subject.new_for_values(uri="foo://quiz",
71
 
                                        interpretation=Interpretation.MUSIC,
72
 
                                        manifestation=Manifestation.FILE)
 
71
                                        interpretation=Interpretation.AUDIO,
 
72
                                        manifestation=Manifestation.FILE_DATA_OBJECT)
73
73
                ev1.append_subject(subj1)
74
74
                ev2.append_subject(subj1)
75
75
                ev2.append_subject(subj2)
95
95
                subj_templ2 = Subject.new_for_values(uri="foo://baz")
96
96
                event_template = Event.new_for_values(
97
97
                                        actor="Boogaloo",
98
 
                                        interpretation=Interpretation.VISIT_EVENT,
 
98
                                        interpretation=Interpretation.ACCESS_EVENT,
99
99
                                        subjects=[subj_templ1,subj_templ2])
100
100
                ids = self.findEventIdsAndWait([event_template],
101
101
                                                num_events=10)