Commit e5abd2c4dc9d0bc089453b5f3c0a1b79e21e660a
1 parent
517db36e
Exists in
community_association
Fixed fetch merge request test
It was necessary to create a fixture containg an user in order to actually test if the merge request were properly fetched. Signed-off-by: Lucas Moura <lucas.moura128@gmail.com> Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
Showing
2 changed files
with
64 additions
and
4 deletions
Show diff stats
... | ... | @@ -0,0 +1,60 @@ |
1 | +[ | |
2 | +{ | |
3 | + "fields": { | |
4 | + "last_name": "Administrator", | |
5 | + "webpage": "", | |
6 | + "twitter": "", | |
7 | + "is_staff": true, | |
8 | + "user_permissions": [], | |
9 | + "date_joined": "2015-01-28T12:34:58.770Z", | |
10 | + "google_talk": "", | |
11 | + "first_name": "Admin", | |
12 | + "is_superuser": true, | |
13 | + "last_login": "2015-08-24T14:33:28.802Z", | |
14 | + "verification_hash": null, | |
15 | + "role": "", | |
16 | + "email": "admin@mail.com", | |
17 | + "username": "admin", | |
18 | + "bio": "", | |
19 | + "needs_update": true, | |
20 | + "is_active": true, | |
21 | + "facebook": "", | |
22 | + "groups": [], | |
23 | + "password": "pbkdf2_sha256$15000$sWnvfYpB8ec4$7dEFg6vSSGPnpEmfRelJ12zkiwacGx9aXx8/8ZFWBSI=", | |
24 | + "institution": "", | |
25 | + "github": "", | |
26 | + "modified": "2015-01-28T12:45:27.375Z" | |
27 | + }, | |
28 | + "model": "accounts.user", | |
29 | + "pk": 1 | |
30 | +}, | |
31 | +{ | |
32 | + "fields": { | |
33 | + "last_name": "user", | |
34 | + "webpage": null, | |
35 | + "twitter": null, | |
36 | + "is_staff": false, | |
37 | + "user_permissions": [], | |
38 | + "date_joined": "2015-08-24T14:33:55.827Z", | |
39 | + "google_talk": null, | |
40 | + "first_name": "user", | |
41 | + "is_superuser": false, | |
42 | + "last_login": "2015-08-24T14:33:55.827Z", | |
43 | + "verification_hash": null, | |
44 | + "role": null, | |
45 | + "email": "user@teste.com", | |
46 | + "username": "user", | |
47 | + "bio": null, | |
48 | + "needs_update": true, | |
49 | + "is_active": true, | |
50 | + "facebook": null, | |
51 | + "groups": [], | |
52 | + "password": "pbkdf2_sha256$15000$9ew6EvFvAIhI$147annuMjzt7em5IRh+3k7wcl7rZ0xjBPSmbUZDdxFo=", | |
53 | + "institution": null, | |
54 | + "github": null, | |
55 | + "modified": "2015-08-24T14:33:55.893Z" | |
56 | + }, | |
57 | + "model": "accounts.user", | |
58 | + "pk": 2 | |
59 | +} | |
60 | +] | ... | ... |
colab/plugins/gitlab/tests/test_data_api.py
... | ... | @@ -6,6 +6,8 @@ import data |
6 | 6 | |
7 | 7 | |
8 | 8 | class GitlabDataApiTest(TestCase): |
9 | + | |
10 | + fixtures = ["gitlab_associations"] | |
9 | 11 | |
10 | 12 | proxied_app = data.proxied_app |
11 | 13 | projects_json = data.projects_json |
... | ... | @@ -54,12 +56,10 @@ class GitlabDataApiTest(TestCase): |
54 | 56 | |
55 | 57 | @patch.object(GitlabDataAPI, 'get_json_data') |
56 | 58 | def test_fetch_merge(self, mock_json): |
57 | - mock_json.side_effect = [self.groups_json, []] | |
59 | + mock_json.side_effect = [self.merge_json, []] | |
58 | 60 | |
59 | 61 | merges = self.api.fetch_merge_request([GitlabProject()]) |
60 | - print merges[0].title | |
61 | - print merges[1].title | |
62 | 62 | self.assertEqual(len(merges), 1) |
63 | 63 | self.assertEqual(merges[0].title, "Merge Title") |
64 | 64 | self.assertEqual(merges[0].description, "description") |
65 | - self.assertEqual(merges[0].user.username, "user") | |
65 | + self.assertEqual(merges[0].get_author().username, "user") | ... | ... |