class TestReferencesService(TestCase):
    def setUp(self):
        self.service = References(user='******', repo='repo')

    def test_GET(self, reqm):
        reqm.return_value = mock_response()
        self.service.get('heads/fnord')
        self.assertEqual(
            reqm.call_args[0],
            ('get', _('repos/user/repo/git/refs/heads/fnord'))
        )

    def test_LIST(self, reqm):
        reqm.return_value = mock_response_result()
        self.service.list().all()
        self.assertEqual(
            reqm.call_args[0],
            ('get', _('repos/user/repo/git/refs'))
        )

    def test_create(self, reqm):
        reqm.return_value = mock_response('post')
        self.service.create({'sha': 'hello', 'ref': 'something'})
        self.assertEqual(
            reqm.call_args[0],
            ('post', _('repos/user/repo/git/refs'))
        )

    def test_update(self, reqm):
        reqm.return_value = mock_response('patch')
        self.service.update('master', {'sha': 'abc123'})
        self.assertEqual(
            reqm.call_args[0],
            ('patch', _('repos/user/repo/git/refs/master'))
        )

    def test_delete(self, reqm):
        reqm.return_value = mock_response('delete')
        self.service.delete('branch')
        self.assertEqual(
            reqm.call_args[0],
            ('delete', _('repos/user/repo/git/refs/branch'))
        )
 def setUp(self):
     self.service = References(user='******', repo='repo')