Beispiel #1
0
 def setUp(self):
     self.hs = Hooks(user='******', repo='re_oct')
Beispiel #2
0
 def setUp(self):
     self.hs = Hooks(user='******', repo='re_oct')
Beispiel #3
0
class TestHooksService(TestCase):

    def setUp(self):
        self.hs = Hooks(user='******', repo='re_oct')

    def test_LIST(self, request_method):
        request_method.return_value = mock_response_result()
        self.hs.list().all()
        self.assertEqual(request_method.call_args[0],
            ('get', _('repos/oct/re_oct/hooks')))

    def test_GET(self, request_method):
        request_method.return_value = mock_response()
        self.hs.get(1)
        self.assertEqual(request_method.call_args[0],
            ('get', _('repos/oct/re_oct/hooks/1')))

    def test_CREATE(self, request_method):
        request_method.return_value = mock_response('post')
        self.hs.create(dict(name='acunote', config={'usr': '******'}))
        self.assertEqual(request_method.call_args[0],
            ('post', _('repos/oct/re_oct/hooks')))

    def test_UPDATE(self, request_method):
        request_method.return_value = mock_response('patch')
        self.hs.update(1, dict(events=['push']))
        self.assertEqual(request_method.call_args[0],
            ('patch', _('repos/oct/re_oct/hooks/1')))

    def test_TEST(self, request_method):
        request_method.return_value = mock_response('post')
        self.hs.test(1)
        self.assertEqual(request_method.call_args[0],
            ('post', _('repos/oct/re_oct/hooks/1/test')))

    def test_DELETE(self, request_method):
        request_method.return_value = mock_response('delete')
        self.hs.delete(1)
        self.assertEqual(request_method.call_args[0],
                ('delete', _('repos/oct/re_oct/hooks/1')))
Beispiel #4
0
class TestHooksService(TestCase):
    def setUp(self):
        self.hs = Hooks(user='******', repo='re_oct')

    def test_LIST(self, request_method):
        request_method.return_value = mock_response_result()
        self.hs.list().all()
        self.assertEqual(request_method.call_args[0],
                         ('get', _('repos/oct/re_oct/hooks')))

    def test_GET(self, request_method):
        request_method.return_value = mock_response()
        self.hs.get(1)
        self.assertEqual(request_method.call_args[0],
                         ('get', _('repos/oct/re_oct/hooks/1')))

    def test_CREATE(self, request_method):
        request_method.return_value = mock_response('post')
        self.hs.create(dict(name='acunote', config={'usr': '******'}))
        self.assertEqual(request_method.call_args[0],
                         ('post', _('repos/oct/re_oct/hooks')))

    def test_UPDATE(self, request_method):
        request_method.return_value = mock_response('patch')
        self.hs.update(1, dict(events=['push']))
        self.assertEqual(request_method.call_args[0],
                         ('patch', _('repos/oct/re_oct/hooks/1')))

    def test_TEST(self, request_method):
        request_method.return_value = mock_response('post')
        self.hs.test(1)
        self.assertEqual(request_method.call_args[0],
                         ('post', _('repos/oct/re_oct/hooks/1/test')))

    def test_DELETE(self, request_method):
        request_method.return_value = mock_response('delete')
        self.hs.delete(1)
        self.assertEqual(request_method.call_args[0],
                         ('delete', _('repos/oct/re_oct/hooks/1')))