Commit e2cae250186f03e2861ddd294aab82a2c939591c
Committed by
Sergio Oliveira
1 parent
24afe1d3
Run tests with setup.py
Signed-off-by: Sergio Oliveira <sergio@tracy.com.br> Signed-off-by: Thiago Ribeiro <thiagitosouza@hotmail.com>
Showing
5 changed files
with
20 additions
and
68 deletions
Show diff stats
colab/proxy/trac/migrations/0001_initial.py
| @@ -37,7 +37,7 @@ class Migration(migrations.Migration): | @@ -37,7 +37,7 @@ class Migration(migrations.Migration): | ||
| 37 | migrations.CreateModel( | 37 | migrations.CreateModel( |
| 38 | name='Revision', | 38 | name='Revision', |
| 39 | fields=[ | 39 | fields=[ |
| 40 | - ('key', models.TextField(serialize=False, primary_key=True, blank=True)), | 40 | + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| 41 | ('rev', models.TextField(blank=True)), | 41 | ('rev', models.TextField(blank=True)), |
| 42 | ('author', models.TextField(blank=True)), | 42 | ('author', models.TextField(blank=True)), |
| 43 | ('message', models.TextField(blank=True)), | 43 | ('message', models.TextField(blank=True)), |
| @@ -47,16 +47,15 @@ class Migration(migrations.Migration): | @@ -47,16 +47,15 @@ class Migration(migrations.Migration): | ||
| 47 | ('modified', models.DateTimeField(null=True, blank=True)), | 47 | ('modified', models.DateTimeField(null=True, blank=True)), |
| 48 | ], | 48 | ], |
| 49 | options={ | 49 | options={ |
| 50 | - 'db_table': 'trac_revision', | ||
| 51 | - 'verbose_name': 'Attachment', | ||
| 52 | - 'verbose_name_plural': 'Attachment', | 50 | + 'verbose_name': 'Revision', |
| 51 | + 'verbose_name_plural': 'Revision', | ||
| 53 | }, | 52 | }, |
| 54 | bases=(models.Model, hitcounter.models.HitCounterModelMixin), | 53 | bases=(models.Model, hitcounter.models.HitCounterModelMixin), |
| 55 | ), | 54 | ), |
| 56 | migrations.CreateModel( | 55 | migrations.CreateModel( |
| 57 | name='Ticket', | 56 | name='Ticket', |
| 58 | fields=[ | 57 | fields=[ |
| 59 | - ('id', models.IntegerField(serialize=False, primary_key=True)), | 58 | + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
| 60 | ('summary', models.TextField(blank=True)), | 59 | ('summary', models.TextField(blank=True)), |
| 61 | ('description_ticket', models.TextField(blank=True)), | 60 | ('description_ticket', models.TextField(blank=True)), |
| 62 | ('milestone', models.TextField(blank=True)), | 61 | ('milestone', models.TextField(blank=True)), |
| @@ -75,24 +74,12 @@ class Migration(migrations.Migration): | @@ -75,24 +74,12 @@ class Migration(migrations.Migration): | ||
| 75 | ('modified_by', models.TextField(blank=True)), | 74 | ('modified_by', models.TextField(blank=True)), |
| 76 | ], | 75 | ], |
| 77 | options={ | 76 | options={ |
| 78 | - 'verbose_name': 'Attachment', | ||
| 79 | - 'verbose_name_plural': 'Attachment', | 77 | + 'verbose_name': 'Ticket', |
| 78 | + 'verbose_name_plural': 'Ticket', | ||
| 80 | }, | 79 | }, |
| 81 | bases=(models.Model, hitcounter.models.HitCounterModelMixin), | 80 | bases=(models.Model, hitcounter.models.HitCounterModelMixin), |
| 82 | ), | 81 | ), |
| 83 | migrations.CreateModel( | 82 | migrations.CreateModel( |
| 84 | - name='TicketCollabCount', | ||
| 85 | - fields=[ | ||
| 86 | - ('author', models.TextField(serialize=False, primary_key=True)), | ||
| 87 | - ('count', models.IntegerField()), | ||
| 88 | - ], | ||
| 89 | - options={ | ||
| 90 | - 'verbose_name': 'Attachment', | ||
| 91 | - 'verbose_name_plural': 'Attachment', | ||
| 92 | - }, | ||
| 93 | - bases=(models.Model,), | ||
| 94 | - ), | ||
| 95 | - migrations.CreateModel( | ||
| 96 | name='Wiki', | 83 | name='Wiki', |
| 97 | fields=[ | 84 | fields=[ |
| 98 | ('title', models.TextField(serialize=False, primary_key=True)), | 85 | ('title', models.TextField(serialize=False, primary_key=True)), |
| @@ -104,21 +91,9 @@ class Migration(migrations.Migration): | @@ -104,21 +91,9 @@ class Migration(migrations.Migration): | ||
| 104 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True)), | 91 | ('user', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True)), |
| 105 | ], | 92 | ], |
| 106 | options={ | 93 | options={ |
| 107 | - 'verbose_name': 'Attachment', | ||
| 108 | - 'verbose_name_plural': 'Attachment', | 94 | + 'verbose_name': 'Wiki', |
| 95 | + 'verbose_name_plural': 'Wiki', | ||
| 109 | }, | 96 | }, |
| 110 | bases=(models.Model, hitcounter.models.HitCounterModelMixin), | 97 | bases=(models.Model, hitcounter.models.HitCounterModelMixin), |
| 111 | ), | 98 | ), |
| 112 | - migrations.CreateModel( | ||
| 113 | - name='WikiCollabCount', | ||
| 114 | - fields=[ | ||
| 115 | - ('author', models.TextField(serialize=False, primary_key=True)), | ||
| 116 | - ('count', models.IntegerField()), | ||
| 117 | - ], | ||
| 118 | - options={ | ||
| 119 | - 'verbose_name': 'Attachment', | ||
| 120 | - 'verbose_name_plural': 'Attachment', | ||
| 121 | - }, | ||
| 122 | - bases=(models.Model,), | ||
| 123 | - ), | ||
| 124 | ] | 99 | ] |
colab/proxy/trac/models.py
| @@ -52,7 +52,6 @@ class Attachment(models.Model, HitCounterModelMixin): | @@ -52,7 +52,6 @@ class Attachment(models.Model, HitCounterModelMixin): | ||
| 52 | class Revision(models.Model, HitCounterModelMixin): | 52 | class Revision(models.Model, HitCounterModelMixin): |
| 53 | update_field = 'created' | 53 | update_field = 'created' |
| 54 | icon_name = 'align-right' | 54 | icon_name = 'align-right' |
| 55 | - key = models.TextField(blank=True, primary_key=True) | ||
| 56 | rev = models.TextField(blank=True) | 55 | rev = models.TextField(blank=True) |
| 57 | author = models.TextField(blank=True) | 56 | author = models.TextField(blank=True) |
| 58 | message = models.TextField(blank=True) | 57 | message = models.TextField(blank=True) |
| @@ -66,9 +65,8 @@ class Revision(models.Model, HitCounterModelMixin): | @@ -66,9 +65,8 @@ class Revision(models.Model, HitCounterModelMixin): | ||
| 66 | return u'{} [{}]'.format(self.repository_name, self.rev) | 65 | return u'{} [{}]'.format(self.repository_name, self.rev) |
| 67 | 66 | ||
| 68 | class Meta: | 67 | class Meta: |
| 69 | - verbose_name = _('Attachment') | ||
| 70 | - verbose_name_plural = _('Attachment') | ||
| 71 | - db_table = 'trac_revision' | 68 | + verbose_name = _('Revision') |
| 69 | + verbose_name_plural = _('Revision') | ||
| 72 | 70 | ||
| 73 | def get_absolute_url(self): | 71 | def get_absolute_url(self): |
| 74 | return u'/changeset/{}/{}'.format(self.rev, self.repository_name) | 72 | return u'/changeset/{}/{}'.format(self.rev, self.repository_name) |
| @@ -83,7 +81,6 @@ class Revision(models.Model, HitCounterModelMixin): | @@ -83,7 +81,6 @@ class Revision(models.Model, HitCounterModelMixin): | ||
| 83 | class Ticket(models.Model, HitCounterModelMixin): | 81 | class Ticket(models.Model, HitCounterModelMixin): |
| 84 | icon_name = 'tag' | 82 | icon_name = 'tag' |
| 85 | type = 'ticket' | 83 | type = 'ticket' |
| 86 | - id = models.IntegerField(primary_key=True) | ||
| 87 | summary = models.TextField(blank=True) | 84 | summary = models.TextField(blank=True) |
| 88 | description_ticket = models.TextField(blank=True) | 85 | description_ticket = models.TextField(blank=True) |
| 89 | milestone = models.TextField(blank=True) | 86 | milestone = models.TextField(blank=True) |
| @@ -113,8 +110,8 @@ class Ticket(models.Model, HitCounterModelMixin): | @@ -113,8 +110,8 @@ class Ticket(models.Model, HitCounterModelMixin): | ||
| 113 | ) | 110 | ) |
| 114 | 111 | ||
| 115 | class Meta: | 112 | class Meta: |
| 116 | - verbose_name = _('Attachment') | ||
| 117 | - verbose_name_plural = _('Attachment') | 113 | + verbose_name = _('Ticket') |
| 114 | + verbose_name_plural = _('Ticket') | ||
| 118 | 115 | ||
| 119 | def get_absolute_url(self): | 116 | def get_absolute_url(self): |
| 120 | return u'/ticket/{}'.format(self.id) | 117 | return u'/ticket/{}'.format(self.id) |
| @@ -147,8 +144,8 @@ class Wiki(Collaboration, HitCounterModelMixin): | @@ -147,8 +144,8 @@ class Wiki(Collaboration, HitCounterModelMixin): | ||
| 147 | return u'{}\n{}'.format(self.wiki_text, self.collaborators) | 144 | return u'{}\n{}'.format(self.wiki_text, self.collaborators) |
| 148 | 145 | ||
| 149 | class Meta: | 146 | class Meta: |
| 150 | - verbose_name = _('Attachment') | ||
| 151 | - verbose_name_plural = _('Attachment') | 147 | + verbose_name = _('Wiki') |
| 148 | + verbose_name_plural = _('Wiki') | ||
| 152 | 149 | ||
| 153 | def get_absolute_url(self): | 150 | def get_absolute_url(self): |
| 154 | return u'/wiki/{}'.format(self.title) | 151 | return u'/wiki/{}'.format(self.title) |
| @@ -165,20 +162,3 @@ class Wiki(Collaboration, HitCounterModelMixin): | @@ -165,20 +162,3 @@ class Wiki(Collaboration, HitCounterModelMixin): | ||
| 165 | except User.DoesNotExist: | 162 | except User.DoesNotExist: |
| 166 | return None | 163 | return None |
| 167 | 164 | ||
| 168 | - | ||
| 169 | -class WikiCollabCount(models.Model): | ||
| 170 | - author = models.TextField(primary_key=True) | ||
| 171 | - count = models.IntegerField() | ||
| 172 | - | ||
| 173 | - class Meta: | ||
| 174 | - verbose_name = _('Attachment') | ||
| 175 | - verbose_name_plural = _('Attachment') | ||
| 176 | - | ||
| 177 | - | ||
| 178 | -class TicketCollabCount(models.Model): | ||
| 179 | - author = models.TextField(primary_key=True) | ||
| 180 | - count = models.IntegerField() | ||
| 181 | - | ||
| 182 | - class Meta: | ||
| 183 | - verbose_name = _('Attachment') | ||
| 184 | - verbose_name_plural = _('Attachment') |
colab/proxy/trac/tests/test_trac.py
| @@ -162,8 +162,6 @@ class WikiTest(TestCase): | @@ -162,8 +162,6 @@ class WikiTest(TestCase): | ||
| 162 | wiki.collaborators = 'collaborators' | 162 | wiki.collaborators = 'collaborators' |
| 163 | wiki.created = '1994-11-05T08:15:30-05:00' | 163 | wiki.created = '1994-11-05T08:15:30-05:00' |
| 164 | wiki.modified = '1994-11-05T08:15:30-05:00' | 164 | wiki.modified = '1994-11-05T08:15:30-05:00' |
| 165 | - from django.conf import settings | ||
| 166 | - print settings.INSTALLED_APPS | ||
| 167 | wiki.save() | 165 | wiki.save() |
| 168 | 166 | ||
| 169 | return wiki | 167 | return wiki |
tests/run.py
| @@ -6,7 +6,7 @@ import sys | @@ -6,7 +6,7 @@ import sys | ||
| 6 | os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' | 6 | os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings' |
| 7 | os.environ['COLAB_SETTINGS'] = 'tests/settings.yaml' | 7 | os.environ['COLAB_SETTINGS'] = 'tests/settings.yaml' |
| 8 | os.environ['COVERAGE_PROCESS_START'] = '.coveragerc' | 8 | os.environ['COVERAGE_PROCESS_START'] = '.coveragerc' |
| 9 | -os.environ['REUSE_DB'] = '0' | 9 | +os.environ['REUSE_DB'] = '1' |
| 10 | 10 | ||
| 11 | import django | 11 | import django |
| 12 | import coverage | 12 | import coverage |
| @@ -14,7 +14,6 @@ import coverage | @@ -14,7 +14,6 @@ import coverage | ||
| 14 | from django.test.utils import get_runner | 14 | from django.test.utils import get_runner |
| 15 | from django.conf import settings | 15 | from django.conf import settings |
| 16 | 16 | ||
| 17 | - | ||
| 18 | def runtests(): | 17 | def runtests(): |
| 19 | if django.VERSION >= (1, 7, 0): | 18 | if django.VERSION >= (1, 7, 0): |
| 20 | django.setup() | 19 | django.setup() |
tests/settings.yaml
| @@ -64,10 +64,10 @@ ROBOTS_NOINDEX: false | @@ -64,10 +64,10 @@ ROBOTS_NOINDEX: false | ||
| 64 | 64 | ||
| 65 | ### Colab proxied apps | 65 | ### Colab proxied apps |
| 66 | PROXIED_APPS: | 66 | PROXIED_APPS: |
| 67 | - gitlab: | ||
| 68 | - upstream: 'http://localhost:8090/gitlab/' | ||
| 69 | - private_token: '' | ||
| 70 | -# trac: | ||
| 71 | -# upstream: 'http://localhost:5000/trac/' | 67 | +# gitlab: |
| 68 | +# upstream: 'http://localhost:8090/gitlab/' | ||
| 69 | +# private_token: '' | ||
| 70 | + trac: | ||
| 71 | + upstream: 'http://localhost:5000/trac/' | ||
| 72 | 72 | ||
| 73 | 73 |