##// END OF EJS Templates
events: rename event_type to events_types as it's multiple
dan -
r377:194e85d5 default
parent child Browse files
Show More
@@ -25,7 +25,7 b' class EventCatcher(object):'
25
25
26 def __init__(self):
26 def __init__(self):
27 self.events = [] # the actual events captured
27 self.events = [] # the actual events captured
28 self.event_types = [] # the types of events captured
28 self.events_types = [] # the types of events captured
29
29
30 def __enter__(self):
30 def __enter__(self):
31 self.event_trigger_patch = mock.patch('rhodecode.events.trigger')
31 self.event_trigger_patch = mock.patch('rhodecode.events.trigger')
@@ -38,4 +38,4 b' class EventCatcher(object):'
38 for call in self.mocked_event_trigger.call_args_list:
38 for call in self.mocked_event_trigger.call_args_list:
39 event = call[0][0]
39 event = call[0][0]
40 self.events.append(event)
40 self.events.append(event)
41 self.event_types.append(type(event))
41 self.events_types.append(type(event))
@@ -52,28 +52,28 b' def scm_extras(user_regular, repo_stub):'
52 def test_create_delete_repo_fires_events(backend):
52 def test_create_delete_repo_fires_events(backend):
53 with EventCatcher() as event_catcher:
53 with EventCatcher() as event_catcher:
54 repo = backend.create_repo()
54 repo = backend.create_repo()
55 assert event_catcher.event_types == [RepoPreCreateEvent, RepoCreatedEvent]
55 assert event_catcher.events_types == [RepoPreCreateEvent, RepoCreatedEvent]
56
56
57 with EventCatcher() as event_catcher:
57 with EventCatcher() as event_catcher:
58 RepoModel().delete(repo)
58 RepoModel().delete(repo)
59 assert event_catcher.event_types == [RepoPreDeleteEvent, RepoDeletedEvent]
59 assert event_catcher.events_types == [RepoPreDeleteEvent, RepoDeletedEvent]
60
60
61
61
62 def test_pull_fires_events(scm_extras):
62 def test_pull_fires_events(scm_extras):
63 with EventCatcher() as event_catcher:
63 with EventCatcher() as event_catcher:
64 hooks_base.pre_push(scm_extras)
64 hooks_base.pre_push(scm_extras)
65 assert event_catcher.event_types == [RepoPrePushEvent]
65 assert event_catcher.events_types == [RepoPrePushEvent]
66
66
67 with EventCatcher() as event_catcher:
67 with EventCatcher() as event_catcher:
68 hooks_base.post_push(scm_extras)
68 hooks_base.post_push(scm_extras)
69 assert event_catcher.event_types == [RepoPushEvent]
69 assert event_catcher.events_types == [RepoPushEvent]
70
70
71
71
72 def test_push_fires_events(scm_extras):
72 def test_push_fires_events(scm_extras):
73 with EventCatcher() as event_catcher:
73 with EventCatcher() as event_catcher:
74 hooks_base.pre_pull(scm_extras)
74 hooks_base.pre_pull(scm_extras)
75 assert event_catcher.event_types == [RepoPrePullEvent]
75 assert event_catcher.events_types == [RepoPrePullEvent]
76
76
77 with EventCatcher() as event_catcher:
77 with EventCatcher() as event_catcher:
78 hooks_base.post_pull(scm_extras)
78 hooks_base.post_pull(scm_extras)
79 assert event_catcher.event_types == [RepoPullEvent]
79 assert event_catcher.events_types == [RepoPullEvent]
General Comments 0
You need to be logged in to leave comments. Login now