'Bitbucket webhook API'

def test_bitbucket_webhook(self, trigger_build):

    client = APIClient()
    resp = client.post('/api/v2/webhook/bitbucket/{0}/'.format(self.project.slug), {'push': {'changes': [{'new': {'name': 'master'}}]}}, format='json')
    trigger_build.assert_has_calls([mock.call(force=True, version=mock.ANY, project=self.project)])
    resp = client.post('/api/v2/webhook/bitbucket/{0}/'.format(self.project.slug), {'push': {'changes': [{'new': {'name': 'non-existent'}}]}}, format='json')
    trigger_build.assert_has_calls([mock.call(force=True, version=mock.ANY, project=self.project)])
