diff --git a/colab/plugins/gitlab/fixtures/gitlab_associations.json b/colab/plugins/gitlab/fixtures/gitlab_associations.json new file mode 100644 index 0000000..725ea0a --- /dev/null +++ b/colab/plugins/gitlab/fixtures/gitlab_associations.json @@ -0,0 +1,60 @@ +[ +{ + "fields": { + "last_name": "Administrator", + "webpage": "", + "twitter": "", + "is_staff": true, + "user_permissions": [], + "date_joined": "2015-01-28T12:34:58.770Z", + "google_talk": "", + "first_name": "Admin", + "is_superuser": true, + "last_login": "2015-08-24T14:33:28.802Z", + "verification_hash": null, + "role": "", + "email": "admin@mail.com", + "username": "admin", + "bio": "", + "needs_update": true, + "is_active": true, + "facebook": "", + "groups": [], + "password": "pbkdf2_sha256$15000$sWnvfYpB8ec4$7dEFg6vSSGPnpEmfRelJ12zkiwacGx9aXx8/8ZFWBSI=", + "institution": "", + "github": "", + "modified": "2015-01-28T12:45:27.375Z" + }, + "model": "accounts.user", + "pk": 1 +}, +{ + "fields": { + "last_name": "user", + "webpage": null, + "twitter": null, + "is_staff": false, + "user_permissions": [], + "date_joined": "2015-08-24T14:33:55.827Z", + "google_talk": null, + "first_name": "user", + "is_superuser": false, + "last_login": "2015-08-24T14:33:55.827Z", + "verification_hash": null, + "role": null, + "email": "user@teste.com", + "username": "user", + "bio": null, + "needs_update": true, + "is_active": true, + "facebook": null, + "groups": [], + "password": "pbkdf2_sha256$15000$9ew6EvFvAIhI$147annuMjzt7em5IRh+3k7wcl7rZ0xjBPSmbUZDdxFo=", + "institution": null, + "github": null, + "modified": "2015-08-24T14:33:55.893Z" + }, + "model": "accounts.user", + "pk": 2 +} +] diff --git a/colab/plugins/gitlab/tests/test_data_api.py b/colab/plugins/gitlab/tests/test_data_api.py index c8c301a..4ed6644 100644 --- a/colab/plugins/gitlab/tests/test_data_api.py +++ b/colab/plugins/gitlab/tests/test_data_api.py @@ -6,6 +6,8 @@ import data class GitlabDataApiTest(TestCase): + + fixtures = ["gitlab_associations"] proxied_app = data.proxied_app projects_json = data.projects_json @@ -54,12 +56,10 @@ class GitlabDataApiTest(TestCase): @patch.object(GitlabDataAPI, 'get_json_data') def test_fetch_merge(self, mock_json): - mock_json.side_effect = [self.groups_json, []] + mock_json.side_effect = [self.merge_json, []] merges = self.api.fetch_merge_request([GitlabProject()]) - print merges[0].title - print merges[1].title self.assertEqual(len(merges), 1) self.assertEqual(merges[0].title, "Merge Title") self.assertEqual(merges[0].description, "description") - self.assertEqual(merges[0].user.username, "user") + self.assertEqual(merges[0].get_author().username, "user") -- libgit2 0.21.2