'Test the bitbucket post commit hook to see if it will only build
versions that are set to be built if the branch they refer to
is updated. Otherwise it is no op.'

def test_bitbucket_post_commit_hook_builds_branch_docs_if_it_should(self):

    r = self.client.post('/bitbucket/', data=json.dumps(self.hg_payload), content_type='application/json')
    self.assertContains(r, '(URL    Build)    Build    Started:    bitbucket.org/pip/pip    [latest]')
    self.hg_payload['commits'] = [{'branch': 'not_ok'}]
    r = self.client.post('/bitbucket/', data=json.dumps(self.hg_payload), content_type='application/json')
    self.assertContains(r, '(URL    Build)    Not    Building:    bitbucket.org/pip/pip    [not_ok]')
    self.hg_payload['commits'] = [{'branch': 'unknown'}]
    r = self.client.post('/bitbucket/', data=json.dumps(self.hg_payload), content_type='application/json')
    self.assertContains(r, '(URL    Build)    No    known    branches    were    pushed    to.')
