##// END OF EJS Templates
events: fix bug, 'url' was not in dict
dan -
r392:b65452d3 default
parent child Browse files
Show More
@@ -68,4 +68,4 b' class RhodecodeEvent(object):'
68 return '<no ip available>'
68 return '<no ip available>'
69
69
70 def as_dict(self):
70 def as_dict(self):
71 return self.MarshmallowSchema().dump(self).data No newline at end of file
71 return self.MarshmallowSchema().dump(self).data
@@ -749,9 +749,10 b' class PullRequestModel(BaseModel):'
749 return ids_to_add, ids_to_remove
749 return ids_to_add, ids_to_remove
750
750
751 def get_url(self, pull_request):
751 def get_url(self, pull_request):
752 return h.url('pullrequest_show', repo_name=self.target_repo.repo_name,
752 return h.url('pullrequest_show',
753 pull_request_id=self.pull_request_id,
753 repo_name=pull_request.target_repo.repo_name,
754 qualified=True)
754 pull_request_id=pull_request.pull_request_id,
755 qualified=True)
755
756
756 def notify_reviewers(self, pull_request, reviewers_ids):
757 def notify_reviewers(self, pull_request, reviewers_ids):
757 # notification to reviewers
758 # notification to reviewers
@@ -47,7 +47,7 b' def test_pullrequest_events_serialized(p'
47 assert data['name'] == EventClass.name
47 assert data['name'] == EventClass.name
48 assert data['repo']['repo_name'] == pr.target_repo.repo_name
48 assert data['repo']['repo_name'] == pr.target_repo.repo_name
49 assert data['pullrequest']['pull_request_id'] == pr.pull_request_id
49 assert data['pullrequest']['pull_request_id'] == pr.pull_request_id
50
50 assert data['pullrequest']['url']
51
51
52 @pytest.mark.backends("git", "hg")
52 @pytest.mark.backends("git", "hg")
53 def test_create_pull_request_events(pr_util):
53 def test_create_pull_request_events(pr_util):
@@ -59,6 +59,7 b' def test_repo_events_serialized(repo_stu'
59 data = event.as_dict()
59 data = event.as_dict()
60 assert data['name'] == EventClass.name
60 assert data['name'] == EventClass.name
61 assert data['repo']['repo_name'] == repo_stub.repo_name
61 assert data['repo']['repo_name'] == repo_stub.repo_name
62 assert data['repo']['url']
62
63
63
64
64 @pytest.mark.parametrize('EventClass', [
65 @pytest.mark.parametrize('EventClass', [
@@ -69,17 +70,19 b' def test_vcs_repo_events_serialize(repo_'
69 data = event.as_dict()
70 data = event.as_dict()
70 assert data['name'] == EventClass.name
71 assert data['name'] == EventClass.name
71 assert data['repo']['repo_name'] == repo_stub.repo_name
72 assert data['repo']['repo_name'] == repo_stub.repo_name
73 assert data['repo']['url']
72
74
73
75
74
76
75 @pytest.mark.parametrize('EventClass', [RepoPushEvent])
77 @pytest.mark.parametrize('EventClass', [RepoPushEvent])
76 def test_vcs_repo_events_serialize(repo_stub, scm_extras, EventClass):
78 def test_vcs_repo_push_event_serialize(repo_stub, scm_extras, EventClass):
77 event = EventClass(repo_name=repo_stub.repo_name,
79 event = EventClass(repo_name=repo_stub.repo_name,
78 pushed_commit_ids=scm_extras['commit_ids'],
80 pushed_commit_ids=scm_extras['commit_ids'],
79 extras=scm_extras)
81 extras=scm_extras)
80 data = event.as_dict()
82 data = event.as_dict()
81 assert data['name'] == EventClass.name
83 assert data['name'] == EventClass.name
82 assert data['repo']['repo_name'] == repo_stub.repo_name
84 assert data['repo']['repo_name'] == repo_stub.repo_name
85 assert data['repo']['url']
83
86
84
87
85 def test_create_delete_repo_fires_events(backend):
88 def test_create_delete_repo_fires_events(backend):
General Comments 0
You need to be logged in to leave comments. Login now