Commit dd6820bcf67e366d135a68cbaf6c050babe0667a
1 parent
47a4f288
Exists in
master
and in
27 other branches
Fixed tests fixtures and updated migrations
Signed-off-by: Macartur Sousa <macartur.sc@gmail.com>
Showing
9 changed files
with
199 additions
and
209 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +# -*- coding: utf-8 -*- | |
| 2 | +from __future__ import unicode_literals | |
| 3 | + | |
| 4 | +from django.db import models, migrations | |
| 5 | +import django.core.validators | |
| 6 | + | |
| 7 | + | |
| 8 | +class Migration(migrations.Migration): | |
| 9 | + | |
| 10 | + dependencies = [ | |
| 11 | + ('accounts', '0005_auto_20150312_1454'), | |
| 12 | + ] | |
| 13 | + | |
| 14 | + operations = [ | |
| 15 | + migrations.AlterField( | |
| 16 | + model_name='user', | |
| 17 | + name='username', | |
| 18 | + field=models.CharField(help_text='Required. 30 characters or fewer. Letters and digits.', unique=True, max_length=30, verbose_name='username', validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username.', 'invalid')]), | |
| 19 | + preserve_default=True, | |
| 20 | + ), | |
| 21 | + ] | ... | ... |
colab/plugins/gitlab/fixtures/test_gitlab_data.json
| ... | ... | @@ -6,34 +6,34 @@ |
| 6 | 6 | "twitter": "usertestcolab", |
| 7 | 7 | "is_staff": false, |
| 8 | 8 | "user_permissions": [], |
| 9 | - "date_joined": "2015-08-26T21:53:25.638Z", | |
| 9 | + "date_joined": "2015-08-28T18:00:59.753Z", | |
| 10 | 10 | "google_talk": null, |
| 11 | 11 | "first_name": "USERtestCoLaB", |
| 12 | 12 | "is_superuser": false, |
| 13 | - "last_login": "2015-08-26T21:53:25.638Z", | |
| 13 | + "last_login": "2015-08-28T18:00:59.753Z", | |
| 14 | 14 | "verification_hash": null, |
| 15 | 15 | "role": null, |
| 16 | 16 | "email": "usertest@colab.com.br", |
| 17 | - "username": "", | |
| 17 | + "username": "usertestcolab", | |
| 18 | 18 | "bio": null, |
| 19 | 19 | "needs_update": true, |
| 20 | 20 | "is_active": true, |
| 21 | 21 | "facebook": "usertestcolab", |
| 22 | 22 | "groups": [], |
| 23 | - "password": "pbkdf2_sha256$15000$d4aHrZW0B4vI$gQImAx0W62PIl/uFtR8/XW2n9R9wC2qgbfb1dKIfkFA=", | |
| 23 | + "password": "pbkdf2_sha256$15000$unxhDDCB1vsw$Esdx3tQ2ayPW08/SImQzbBeRiK8Hoa6fBZhw3dMQga8=", | |
| 24 | 24 | "institution": null, |
| 25 | 25 | "github": null, |
| 26 | - "modified": "2015-08-26T21:54:38.592Z" | |
| 26 | + "modified": "2015-08-28T18:00:59.996Z" | |
| 27 | 27 | }, |
| 28 | 28 | "model": "accounts.user", |
| 29 | 29 | "pk": 1 |
| 30 | 30 | }, |
| 31 | 31 | { |
| 32 | 32 | "fields": { |
| 33 | - "last_activity_at": "2015-08-26T22:01:46.401Z", | |
| 33 | + "last_activity_at": "2015-08-28T18:01:28.469Z", | |
| 34 | 34 | "description": "", |
| 35 | 35 | "name_with_namespace": "Software Public / Colab", |
| 36 | - "created_at": "2015-08-26T22:01:42.569Z", | |
| 36 | + "created_at": "2015-08-28T18:01:28.467Z", | |
| 37 | 37 | "path_with_namespace": "softwarepublico/colab", |
| 38 | 38 | "public": true, |
| 39 | 39 | "name": "colab" |
| ... | ... | @@ -43,8 +43,21 @@ |
| 43 | 43 | }, |
| 44 | 44 | { |
| 45 | 45 | "fields": { |
| 46 | + "last_activity_at": "2015-08-28T18:01:28.491Z", | |
| 47 | + "description": "", | |
| 48 | + "name_with_namespace": "Software Public / ColabInc", | |
| 49 | + "created_at": "2015-08-28T18:01:28.489Z", | |
| 50 | + "path_with_namespace": "softwarepublico/colabinc", | |
| 51 | + "public": true, | |
| 52 | + "name": "colabinc" | |
| 53 | + }, | |
| 54 | + "model": "gitlab.gitlabproject", | |
| 55 | + "pk": 2 | |
| 56 | +}, | |
| 57 | +{ | |
| 58 | + "fields": { | |
| 46 | 59 | "path": "softwarepublico", |
| 47 | - "name": "softwarepublico", | |
| 60 | + "name": "Software Public", | |
| 48 | 61 | "owner_id": 1 |
| 49 | 62 | }, |
| 50 | 63 | "model": "gitlab.gitlabgroup", |
| ... | ... | @@ -55,7 +68,7 @@ |
| 55 | 68 | "target_branch": "", |
| 56 | 69 | "description": "Merge request for plugin support", |
| 57 | 70 | "source_branch": "", |
| 58 | - "created_at": "2015-08-26T22:02:22.960Z", | |
| 71 | + "created_at": "2015-08-28T18:01:28.512Z", | |
| 59 | 72 | "title": "Include plugin support", |
| 60 | 73 | "project": 1, |
| 61 | 74 | "iid": 1, |
| ... | ... | @@ -67,10 +80,26 @@ |
| 67 | 80 | }, |
| 68 | 81 | { |
| 69 | 82 | "fields": { |
| 83 | + "target_branch": "", | |
| 84 | + "description": "Merge request for test support", | |
| 85 | + "source_branch": "", | |
| 86 | + "created_at": "2015-08-28T18:01:28.561Z", | |
| 87 | + "title": "Include test support", | |
| 88 | + "project": 2, | |
| 89 | + "iid": 1, | |
| 90 | + "state": "Closed", | |
| 91 | + "user": 1 | |
| 92 | + }, | |
| 93 | + "model": "gitlab.gitlabmergerequest", | |
| 94 | + "pk": 2 | |
| 95 | +}, | |
| 96 | +{ | |
| 97 | + "fields": { | |
| 70 | 98 | "description": "Issue reported to colab", |
| 71 | 99 | "title": "Issue for colab", |
| 72 | - "created_at": "2015-08-26T22:03:09.410Z", | |
| 100 | + "created_at": "2015-08-28T18:01:28.590Z", | |
| 73 | 101 | "project": 1, |
| 102 | + "iid": 1, | |
| 74 | 103 | "state": "Open", |
| 75 | 104 | "user": 1 |
| 76 | 105 | }, |
| ... | ... | @@ -79,12 +108,24 @@ |
| 79 | 108 | }, |
| 80 | 109 | { |
| 81 | 110 | "fields": { |
| 111 | + "description": "Issue reported to colab", | |
| 112 | + "title": "Issue for colab", | |
| 113 | + "created_at": "2015-08-28T18:01:28.628Z", | |
| 114 | + "project": 2, | |
| 115 | + "iid": 1, | |
| 116 | + "state": "Open", | |
| 117 | + "user": 1 | |
| 118 | + }, | |
| 119 | + "model": "gitlab.gitlabissue", | |
| 120 | + "pk": 2 | |
| 121 | +}, | |
| 122 | +{ | |
| 123 | + "fields": { | |
| 82 | 124 | "body": "Comment to merge request", |
| 83 | - "parent_id": 1, | |
| 84 | - "created_at": "2015-08-26T22:03:50.590Z", | |
| 125 | + "created_at": "2015-08-28T18:01:28.663Z", | |
| 85 | 126 | "issue_comment": false, |
| 86 | 127 | "project": 1, |
| 87 | - "iid": 1, | |
| 128 | + "parent_id": 1, | |
| 88 | 129 | "user": 1 |
| 89 | 130 | }, |
| 90 | 131 | "model": "gitlab.gitlabcomment", |
| ... | ... | @@ -93,11 +134,10 @@ |
| 93 | 134 | { |
| 94 | 135 | "fields": { |
| 95 | 136 | "body": "Comment to issue", |
| 96 | - "parent_id": 1, | |
| 97 | - "created_at": "2015-08-26T22:04:33.063Z", | |
| 137 | + "created_at": "2015-08-28T18:01:28.693Z", | |
| 98 | 138 | "issue_comment": true, |
| 99 | 139 | "project": 1, |
| 100 | - "iid": 2, | |
| 140 | + "parent_id": 1, | |
| 101 | 141 | "user": 1 |
| 102 | 142 | }, |
| 103 | 143 | "model": "gitlab.gitlabcomment", | ... | ... |
colab/plugins/gitlab/migrations/0001_initial.py
| ... | ... | @@ -2,15 +2,82 @@ |
| 2 | 2 | from __future__ import unicode_literals |
| 3 | 3 | |
| 4 | 4 | from django.db import models, migrations |
| 5 | +import django.db.models.deletion | |
| 6 | +import hitcounter.models | |
| 7 | +from django.conf import settings | |
| 5 | 8 | |
| 6 | 9 | |
| 7 | 10 | class Migration(migrations.Migration): |
| 8 | 11 | |
| 9 | 12 | dependencies = [ |
| 13 | + migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 10 | 14 | ] |
| 11 | 15 | |
| 12 | 16 | operations = [ |
| 13 | 17 | migrations.CreateModel( |
| 18 | + name='GitlabComment', | |
| 19 | + fields=[ | |
| 20 | + ('id', models.IntegerField(serialize=False, primary_key=True)), | |
| 21 | + ('body', models.TextField()), | |
| 22 | + ('created_at', models.DateTimeField(null=True, blank=True)), | |
| 23 | + ('issue_comment', models.BooleanField(default=True)), | |
| 24 | + ('parent_id', models.IntegerField(null=True)), | |
| 25 | + ], | |
| 26 | + options={ | |
| 27 | + 'verbose_name': 'Gitlab Comments', | |
| 28 | + 'verbose_name_plural': 'Gitlab Comments', | |
| 29 | + }, | |
| 30 | + bases=(models.Model,), | |
| 31 | + ), | |
| 32 | + migrations.CreateModel( | |
| 33 | + name='GitlabGroup', | |
| 34 | + fields=[ | |
| 35 | + ('id', models.IntegerField(serialize=False, primary_key=True)), | |
| 36 | + ('name', models.CharField(max_length=100)), | |
| 37 | + ('path', models.CharField(max_length=100)), | |
| 38 | + ('owner_id', models.IntegerField(null=True)), | |
| 39 | + ], | |
| 40 | + options={ | |
| 41 | + 'verbose_name': 'Gitlab Group', | |
| 42 | + 'verbose_name_plural': 'Gitlab Groups', | |
| 43 | + }, | |
| 44 | + bases=(models.Model,), | |
| 45 | + ), | |
| 46 | + migrations.CreateModel( | |
| 47 | + name='GitlabIssue', | |
| 48 | + fields=[ | |
| 49 | + ('id', models.IntegerField(serialize=False, primary_key=True)), | |
| 50 | + ('iid', models.IntegerField(null=True)), | |
| 51 | + ('title', models.TextField()), | |
| 52 | + ('description', models.TextField()), | |
| 53 | + ('state', models.TextField()), | |
| 54 | + ('created_at', models.DateTimeField(null=True, blank=True)), | |
| 55 | + ], | |
| 56 | + options={ | |
| 57 | + 'verbose_name': 'Gitlab Issue', | |
| 58 | + 'verbose_name_plural': 'Gitlab Issues', | |
| 59 | + }, | |
| 60 | + bases=(models.Model,), | |
| 61 | + ), | |
| 62 | + migrations.CreateModel( | |
| 63 | + name='GitlabMergeRequest', | |
| 64 | + fields=[ | |
| 65 | + ('id', models.IntegerField(serialize=False, primary_key=True)), | |
| 66 | + ('iid', models.IntegerField(null=True)), | |
| 67 | + ('target_branch', models.TextField()), | |
| 68 | + ('source_branch', models.TextField()), | |
| 69 | + ('description', models.TextField()), | |
| 70 | + ('title', models.TextField()), | |
| 71 | + ('state', models.TextField()), | |
| 72 | + ('created_at', models.DateTimeField(null=True, blank=True)), | |
| 73 | + ], | |
| 74 | + options={ | |
| 75 | + 'verbose_name': 'Gitlab Merge Request', | |
| 76 | + 'verbose_name_plural': 'Gitlab Merge Requests', | |
| 77 | + }, | |
| 78 | + bases=(models.Model,), | |
| 79 | + ), | |
| 80 | + migrations.CreateModel( | |
| 14 | 81 | name='GitlabProject', |
| 15 | 82 | fields=[ |
| 16 | 83 | ('id', models.IntegerField(serialize=False, primary_key=True)), |
| ... | ... | @@ -20,9 +87,48 @@ class Migration(migrations.Migration): |
| 20 | 87 | ('name_with_namespace', models.TextField()), |
| 21 | 88 | ('created_at', models.DateTimeField(blank=True)), |
| 22 | 89 | ('last_activity_at', models.DateTimeField(blank=True)), |
| 90 | + ('path_with_namespace', models.TextField(null=True, blank=True)), | |
| 23 | 91 | ], |
| 24 | 92 | options={ |
| 93 | + 'verbose_name': 'Gitlab Project', | |
| 94 | + 'verbose_name_plural': 'Gitlab Projects', | |
| 25 | 95 | }, |
| 26 | - bases=(models.Model,), | |
| 96 | + bases=(models.Model, hitcounter.models.HitCounterModelMixin), | |
| 97 | + ), | |
| 98 | + migrations.AddField( | |
| 99 | + model_name='gitlabmergerequest', | |
| 100 | + name='project', | |
| 101 | + field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to='gitlab.GitlabProject', null=True), | |
| 102 | + preserve_default=True, | |
| 103 | + ), | |
| 104 | + migrations.AddField( | |
| 105 | + model_name='gitlabmergerequest', | |
| 106 | + name='user', | |
| 107 | + field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True), | |
| 108 | + preserve_default=True, | |
| 109 | + ), | |
| 110 | + migrations.AddField( | |
| 111 | + model_name='gitlabissue', | |
| 112 | + name='project', | |
| 113 | + field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to='gitlab.GitlabProject', null=True), | |
| 114 | + preserve_default=True, | |
| 115 | + ), | |
| 116 | + migrations.AddField( | |
| 117 | + model_name='gitlabissue', | |
| 118 | + name='user', | |
| 119 | + field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True), | |
| 120 | + preserve_default=True, | |
| 121 | + ), | |
| 122 | + migrations.AddField( | |
| 123 | + model_name='gitlabcomment', | |
| 124 | + name='project', | |
| 125 | + field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to='gitlab.GitlabProject', null=True), | |
| 126 | + preserve_default=True, | |
| 127 | + ), | |
| 128 | + migrations.AddField( | |
| 129 | + model_name='gitlabcomment', | |
| 130 | + name='user', | |
| 131 | + field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True), | |
| 132 | + preserve_default=True, | |
| 27 | 133 | ), |
| 28 | 134 | ] | ... | ... |
colab/plugins/gitlab/migrations/0002_auto_20150205_1220.py
| ... | ... | @@ -1,69 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -from __future__ import unicode_literals | |
| 3 | - | |
| 4 | -from django.db import models, migrations | |
| 5 | -import django.db.models.deletion | |
| 6 | -from django.conf import settings | |
| 7 | - | |
| 8 | - | |
| 9 | -class Migration(migrations.Migration): | |
| 10 | - | |
| 11 | - dependencies = [ | |
| 12 | - migrations.swappable_dependency(settings.AUTH_USER_MODEL), | |
| 13 | - ('gitlab', '0001_initial'), | |
| 14 | - ] | |
| 15 | - | |
| 16 | - operations = [ | |
| 17 | - migrations.CreateModel( | |
| 18 | - name='GitlabComment', | |
| 19 | - fields=[ | |
| 20 | - ('id', models.IntegerField(serialize=False, primary_key=True)), | |
| 21 | - ('body', models.TextField()), | |
| 22 | - ('created_at', models.DateTimeField(blank=True)), | |
| 23 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True)), | |
| 24 | - ], | |
| 25 | - options={ | |
| 26 | - 'verbose_name': 'Gitlab Comments', | |
| 27 | - 'verbose_name_plural': 'Gitlab Comments', | |
| 28 | - }, | |
| 29 | - bases=(models.Model,), | |
| 30 | - ), | |
| 31 | - migrations.CreateModel( | |
| 32 | - name='GitlabIssue', | |
| 33 | - fields=[ | |
| 34 | - ('id', models.IntegerField(serialize=False, primary_key=True)), | |
| 35 | - ('title', models.TextField()), | |
| 36 | - ('description', models.TextField()), | |
| 37 | - ('state', models.TextField()), | |
| 38 | - ('project', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to='gitlab.GitlabProject', null=True)), | |
| 39 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True)), | |
| 40 | - ], | |
| 41 | - options={ | |
| 42 | - 'verbose_name': 'Gitlab Collaboration', | |
| 43 | - 'verbose_name_plural': 'Gitlab Collaborations', | |
| 44 | - }, | |
| 45 | - bases=(models.Model,), | |
| 46 | - ), | |
| 47 | - migrations.CreateModel( | |
| 48 | - name='GitlabMergeRequest', | |
| 49 | - fields=[ | |
| 50 | - ('id', models.IntegerField(serialize=False, primary_key=True)), | |
| 51 | - ('target_branch', models.TextField()), | |
| 52 | - ('source_branch', models.TextField()), | |
| 53 | - ('description', models.TextField()), | |
| 54 | - ('title', models.TextField()), | |
| 55 | - ('state', models.TextField()), | |
| 56 | - ('project', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to='gitlab.GitlabProject', null=True)), | |
| 57 | - ('user', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True)), | |
| 58 | - ], | |
| 59 | - options={ | |
| 60 | - 'verbose_name': 'Gitlab Merge Request', | |
| 61 | - 'verbose_name_plural': 'Gitlab Merge Requests', | |
| 62 | - }, | |
| 63 | - bases=(models.Model,), | |
| 64 | - ), | |
| 65 | - migrations.AlterModelOptions( | |
| 66 | - name='gitlabproject', | |
| 67 | - options={'verbose_name': 'Gitlab Project', 'verbose_name_plural': 'Gitlab Projects'}, | |
| 68 | - ), | |
| 69 | - ] |
colab/plugins/gitlab/migrations/0003_auto_20150211_1203.py
| ... | ... | @@ -1,61 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -from __future__ import unicode_literals | |
| 3 | - | |
| 4 | -from django.db import models, migrations | |
| 5 | -import django.db.models.deletion | |
| 6 | - | |
| 7 | - | |
| 8 | -class Migration(migrations.Migration): | |
| 9 | - | |
| 10 | - dependencies = [ | |
| 11 | - ('gitlab', '0002_auto_20150205_1220'), | |
| 12 | - ] | |
| 13 | - | |
| 14 | - operations = [ | |
| 15 | - migrations.AlterModelOptions( | |
| 16 | - name='gitlabissue', | |
| 17 | - options={'verbose_name': 'Gitlab Issue', 'verbose_name_plural': 'Gitlab Issues'}, | |
| 18 | - ), | |
| 19 | - migrations.AddField( | |
| 20 | - model_name='gitlabcomment', | |
| 21 | - name='issue_comment', | |
| 22 | - field=models.BooleanField(default=True), | |
| 23 | - preserve_default=True, | |
| 24 | - ), | |
| 25 | - migrations.AddField( | |
| 26 | - model_name='gitlabcomment', | |
| 27 | - name='parent_id', | |
| 28 | - field=models.IntegerField(null=True), | |
| 29 | - preserve_default=True, | |
| 30 | - ), | |
| 31 | - migrations.AddField( | |
| 32 | - model_name='gitlabcomment', | |
| 33 | - name='project', | |
| 34 | - field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to='gitlab.GitlabProject', null=True), | |
| 35 | - preserve_default=True, | |
| 36 | - ), | |
| 37 | - migrations.AddField( | |
| 38 | - model_name='gitlabissue', | |
| 39 | - name='created_at', | |
| 40 | - field=models.DateTimeField(null=True, blank=True), | |
| 41 | - preserve_default=True, | |
| 42 | - ), | |
| 43 | - migrations.AddField( | |
| 44 | - model_name='gitlabmergerequest', | |
| 45 | - name='created_at', | |
| 46 | - field=models.DateTimeField(null=True, blank=True), | |
| 47 | - preserve_default=True, | |
| 48 | - ), | |
| 49 | - migrations.AddField( | |
| 50 | - model_name='gitlabproject', | |
| 51 | - name='path_with_namespace', | |
| 52 | - field=models.TextField(null=True, blank=True), | |
| 53 | - preserve_default=True, | |
| 54 | - ), | |
| 55 | - migrations.AlterField( | |
| 56 | - model_name='gitlabcomment', | |
| 57 | - name='created_at', | |
| 58 | - field=models.DateTimeField(null=True, blank=True), | |
| 59 | - preserve_default=True, | |
| 60 | - ), | |
| 61 | - ] |
colab/plugins/gitlab/migrations/0004_auto_20150630_1149.py
| ... | ... | @@ -1,26 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -from __future__ import unicode_literals | |
| 3 | - | |
| 4 | -from django.db import models, migrations | |
| 5 | - | |
| 6 | - | |
| 7 | -class Migration(migrations.Migration): | |
| 8 | - | |
| 9 | - dependencies = [ | |
| 10 | - ('gitlab', '0003_auto_20150211_1203'), | |
| 11 | - ] | |
| 12 | - | |
| 13 | - operations = [ | |
| 14 | - migrations.AddField( | |
| 15 | - model_name='gitlabcomment', | |
| 16 | - name='iid', | |
| 17 | - field=models.IntegerField(null=True), | |
| 18 | - preserve_default=True, | |
| 19 | - ), | |
| 20 | - migrations.AddField( | |
| 21 | - model_name='gitlabmergerequest', | |
| 22 | - name='iid', | |
| 23 | - field=models.IntegerField(null=True), | |
| 24 | - preserve_default=True, | |
| 25 | - ), | |
| 26 | - ] |
colab/plugins/gitlab/migrations/0005_auto_20150806_1230.py
| ... | ... | @@ -1,24 +0,0 @@ |
| 1 | -# -*- coding: utf-8 -*- | |
| 2 | -from __future__ import unicode_literals | |
| 3 | - | |
| 4 | -from django.db import models, migrations | |
| 5 | - | |
| 6 | - | |
| 7 | -class Migration(migrations.Migration): | |
| 8 | - | |
| 9 | - dependencies = [ | |
| 10 | - ('gitlab', '0004_auto_20150630_1149'), | |
| 11 | - ] | |
| 12 | - | |
| 13 | - operations = [ | |
| 14 | - migrations.RemoveField( | |
| 15 | - model_name='gitlabcomment', | |
| 16 | - name='iid', | |
| 17 | - ), | |
| 18 | - migrations.AddField( | |
| 19 | - model_name='gitlabissue', | |
| 20 | - name='iid', | |
| 21 | - field=models.IntegerField(null=True), | |
| 22 | - preserve_default=True, | |
| 23 | - ), | |
| 24 | - ] |
colab/plugins/gitlab/models.py
| ... | ... | @@ -16,7 +16,7 @@ class GitlabProject(models.Model, HitCounterModelMixin): |
| 16 | 16 | path_with_namespace = models.TextField(blank=True, null=True) |
| 17 | 17 | |
| 18 | 18 | @property |
| 19 | - def group(self): | |
| 19 | + def namespace(self): | |
| 20 | 20 | return self.path_with_namespace.split('/')[0] |
| 21 | 21 | |
| 22 | 22 | @property |
| ... | ... | @@ -42,7 +42,7 @@ class GitlabGroup(models.Model): |
| 42 | 42 | projects = GitlabProject.objects.all() |
| 43 | 43 | result = list() |
| 44 | 44 | for project in projects: |
| 45 | - if self.path in project.group: | |
| 45 | + if self.path in project.namespace: | |
| 46 | 46 | result.append(project) |
| 47 | 47 | return result |
| 48 | 48 | ... | ... |
colab/plugins/gitlab/tests/test_gitlab.py
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | Test User class. |
| 3 | 3 | Objective: Test parameters, and behavior. |
| 4 | 4 | """ |
| 5 | +from datetime import datetime | |
| 5 | 6 | from django.test import TestCase, Client |
| 6 | 7 | from colab.plugins.gitlab.models import (GitlabProject, GitlabGroup, |
| 7 | 8 | GitlabIssue, GitlabComment, |
| ... | ... | @@ -10,10 +11,11 @@ from colab.plugins.gitlab.models import (GitlabProject, GitlabGroup, |
| 10 | 11 | |
| 11 | 12 | class GitlabTest(TestCase): |
| 12 | 13 | |
| 13 | - fixtures = ["test_gitlab_data"] | |
| 14 | + fixtures = ['test_gitlab_data'] | |
| 14 | 15 | |
| 15 | 16 | def setUp(self): |
| 16 | 17 | self.client = Client() |
| 18 | + | |
| 17 | 19 | super(GitlabTest, self).setUp() |
| 18 | 20 | |
| 19 | 21 | def tearDown(self): |
| ... | ... | @@ -21,16 +23,11 @@ class GitlabTest(TestCase): |
| 21 | 23 | |
| 22 | 24 | def test_data_integrity(self): |
| 23 | 25 | self.assertEqual(GitlabGroup.objects.all().count(), 1) |
| 24 | - self.assertEqual(GitlabProject.objects.all().count(), 1) | |
| 25 | - self.assertEqual(GitlabMergeRequest.objects.all().count(), 1) | |
| 26 | - self.assertEqual(GitlabIssue.objects.all().count(), 1) | |
| 26 | + self.assertEqual(GitlabProject.objects.all().count(), 2) | |
| 27 | + self.assertEqual(GitlabMergeRequest.objects.all().count(), 2) | |
| 28 | + self.assertEqual(GitlabIssue.objects.all().count(), 2) | |
| 27 | 29 | self.assertEqual(GitlabComment.objects.all().count(), 2) |
| 28 | 30 | |
| 29 | - def test_group_projects(self): | |
| 30 | - group = GitlabGroup.objects.get(id=1) | |
| 31 | - self.assertEqual(len(group.projects), 1) | |
| 32 | - self.assertEqual(group.projects[0].name, 'colab') | |
| 33 | - | |
| 34 | 31 | def test_project_url(self): |
| 35 | 32 | self.assertEqual(GitlabProject.objects.get(id=1).url, |
| 36 | 33 | '/gitlab/softwarepublico/colab') |
| ... | ... | @@ -38,7 +35,13 @@ class GitlabTest(TestCase): |
| 38 | 35 | def test_project_group(self): |
| 39 | 36 | project = GitlabProject.objects.get(id=1) |
| 40 | 37 | self.assertEqual(project.name, 'colab') |
| 41 | - self.assertEqual(project.group, 'softwarepublico') | |
| 38 | + self.assertEqual(project.namespace, 'softwarepublico') | |
| 39 | + | |
| 40 | + def test_namespace_projects(self): | |
| 41 | + group = GitlabGroup.objects.get(id=1) | |
| 42 | + self.assertEqual(len(group.projects), 2) | |
| 43 | + self.assertEqual(group.projects[0].name, 'colab') | |
| 44 | + self.assertEqual(group.projects[1].name, 'colabinc') | |
| 42 | 45 | |
| 43 | 46 | def test_merge_request_url(self): |
| 44 | 47 | self.assertEqual(GitlabMergeRequest.objects.get(id=1).url, | ... | ... |