Commit 6973523533c7ab7e28da731650325f3e39e99793
1 parent
c5e39ce7
Exists in
community_association
Initial tests of data_api
Signed-off-by: Matheus Fernandes <matheus.souza.fernandes@gmail.com> Signed-off-by: Lucas Moura <lucas.mouta128@gmail.com>
Showing
2 changed files
with
28 additions
and
1 deletions
Show diff stats
colab/plugins/gitlab/data_api.py
... | ... | @@ -28,7 +28,6 @@ class GitlabDataAPI(ProxyDataAPI): |
28 | 28 | if upstream[-1] == '/': |
29 | 29 | upstream = upstream[:-1] |
30 | 30 | |
31 | - print u'{}{}?{}'.format(upstream, path, params) | |
32 | 31 | return u'{}{}?{}'.format(upstream, path, params) |
33 | 32 | |
34 | 33 | def get_json_data(self, api_url, page, pages=1000): | ... | ... |
... | ... | @@ -0,0 +1,28 @@ |
1 | +from django.test import TestCase | |
2 | +from colab.plugins.gitlab.data_api import GitlabDataAPI | |
3 | +from mock import patch | |
4 | + | |
5 | + | |
6 | +class GitlabDataApiTest(TestCase): | |
7 | + | |
8 | + data = {'menu_title': None, | |
9 | + 'private_token': 'token', | |
10 | + 'upstream': 'localhost/gitlab/'} | |
11 | + | |
12 | + def setUp(self): | |
13 | + self.api = GitlabDataAPI() | |
14 | + | |
15 | + def tearDown(self): | |
16 | + pass | |
17 | + | |
18 | + @patch.dict('django.conf.settings.PROXIED_APPS', gitlab=data) | |
19 | + def test_resquest_url(self): | |
20 | + url = self.api.get_request_url('/test/') | |
21 | + expected = 'localhost/gitlab/test/?private_token=token' | |
22 | + self.assertEqual(url, expected) | |
23 | + | |
24 | + @patch.dict('django.conf.settings.PROXIED_APPS', gitlab=data) | |
25 | + def test_resquest_url_with_params(self): | |
26 | + url = self.api.get_request_url('/test/', param='param') | |
27 | + expected = 'localhost/gitlab/test/?private_token=token¶m=param' | |
28 | + self.assertEqual(url, expected) | ... | ... |