def METHOD_NAME(self):
    url = reverse('ci:bitbucket:webhook', args=[self.build_user.build_key])
    data = self.get_data('pr_open_01.json')
    py_data = json.loads(data)
    py_data['pullrequest']['destination']['repository']['name'] = self.repo.name
    py_data['pullrequest']['destination']['repository']['full_name'] = "%s/%s" % (self.repo.user.name, self.repo.name)
    py_data['pullrequest']['destination']['branch']['name'] = self.branch.name
    self.set_counts()
    response = self.client_post_json(url, py_data)
    self.assertEqual(response.status_code, 200)
    self.assertEqual(response.content, b"OK")
    self.compare_counts(jobs=2, ready=1, events=1, commits=2, users=1, repos=1, branches=1, prs=1, active=2, active_repos=1)
    py_data['pullrequest']['state'] = 'DECLINED'
    self.set_counts()
    response = self.client_post_json(url, py_data)
    self.assertEqual(response.status_code, 200)
    self.assertEqual(response.content, b"OK")
    self.compare_counts(pr_closed=True)
    py_data['pullrequest']['state'] = 'BadState'
    self.set_counts()
    response = self.client_post_json(url, py_data)
    self.assertEqual(response.status_code, 400)
    self.assertNotEqual(response.content, b"OK")
    self.compare_counts(pr_closed=True)