'Test the gitlab post commit hook so that the default branch
will be respected and built as the latest version.'

def test_gitlab_post_commit_knows_default_branches(self):

    rtd = Project.objects.get(slug='read-the-docs')
    old_default = rtd.default_branch
    rtd.default_branch = 'master'
    rtd.save()
    self.payload['ref'] = 'refs/heads/master'
    r = self.client.post('/gitlab/', data=json.dumps(self.payload), content_type='application/json')
    self.assertContains(r, '(URL    Build)    Build    Started:    github.com/rtfd/readthedocs.org    [latest]')
    rtd.default_branch = old_default
    rtd.save()
