{"action":"created","issue":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1927","labels_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1927/labels{/name}","comments_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1927/comments","events_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1927/events","html_url":"https://github.com/Valloric/YouCompleteMe/pull/1927","id":127779750,"number":1927,"title":"[READY] Fix issue in EventNotification tests","user":{"login":"micbou","id":10026824,"avatar_url":"https://avatars.githubusercontent.com/u/10026824?v=3","gravatar_id":"","url":"https://api.github.com/users/micbou","html_url":"https://github.com/micbou","followers_url":"https://api.github.com/users/micbou/followers","following_url":"https://api.github.com/users/micbou/following{/other_user}","gists_url":"https://api.github.com/users/micbou/gists{/gist_id}","starred_url":"https://api.github.com/users/micbou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/micbou/subscriptions","organizations_url":"https://api.github.com/users/micbou/orgs","repos_url":"https://api.github.com/users/micbou/repos","events_url":"https://api.github.com/users/micbou/events{/privacy}","received_events_url":"https://api.github.com/users/micbou/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-20T20:44:04Z","updated_at":"2016-01-20T21:15:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/pulls/1927","html_url":"https://github.com/Valloric/YouCompleteMe/pull/1927","diff_url":"https://github.com/Valloric/YouCompleteMe/pull/1927.diff","patch_url":"https://github.com/Valloric/YouCompleteMe/pull/1927.patch"},"body":"While I was reviewing PR #1905, I found an issue with the `EventNotification` tests. It's easy to reproduce. You just need to comment [this line in `python/ycm/youcompleteme.py`](https://github.com/Valloric/YouCompleteMe/blob/master/python/ycm/youcompleteme.py#L508) and run the tests. With this change, the `EventNotification` tests should fail since the second call of `ValidateParseRequest` re-raises the warning. However, tests are still passing because `assert_has_calls` does not check if a call was not made. For example, if `functionA` is called twice, both `assert_has_calls( [ functionA ] )` and `assert_has_calls( [ functionA, functionA ] )` are successful.\r\n\r\nTo fix this, we just need to check the number of calls using `call_count`. This is done by creating a subclass of `MagicMock` implementing the `assert_has_exact_calls` method and using it in tests.\n\n<!-- Reviewable:start -->\n[<img src=\"https://reviewable.io/review_button.png\" height=40 alt=\"Review on Reviewable\"/>](https://reviewable.io/reviews/valloric/youcompleteme/1927)\n<!-- Reviewable:end -->\n"},"comment":{"url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/comments/173361298","html_url":"https://github.com/Valloric/YouCompleteMe/pull/1927#issuecomment-173361298","issue_url":"https://api.github.com/repos/Valloric/YouCompleteMe/issues/1927","id":173361298,"user":{"login":"vheon","id":90633,"avatar_url":"https://avatars.githubusercontent.com/u/90633?v=3","gravatar_id":"","url":"https://api.github.com/users/vheon","html_url":"https://github.com/vheon","followers_url":"https://api.github.com/users/vheon/followers","following_url":"https://api.github.com/users/vheon/following{/other_user}","gists_url":"https://api.github.com/users/vheon/gists{/gist_id}","starred_url":"https://api.github.com/users/vheon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vheon/subscriptions","organizations_url":"https://api.github.com/users/vheon/orgs","repos_url":"https://api.github.com/users/vheon/repos","events_url":"https://api.github.com/users/vheon/events{/privacy}","received_events_url":"https://api.github.com/users/vheon/received_events","type":"User","site_admin":false},"created_at":"2016-01-20T21:15:07Z","updated_at":"2016-01-20T21:15:07Z","body":"<img class=\"emoji\" title=\":lgtm:\" alt=\":lgtm:\" align=\"absmiddle\" src=\"https://reviewable.io/lgtm.png\" height=\"20\" width=\"61\"/> \n\n---\n\nReviewed 2 of 2 files at r1.\nReview status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.\n\n---\n\n\n\n*Comments from the [review on Reviewable.io](https://reviewable.io:443/reviews/valloric/youcompleteme/1927#-:-K8VsrcJV-b8oGxBHwuw:980077423)*\n<!-- Sent from Reviewable.io -->\n"}}