Commit e2cae250186f03e2861ddd294aab82a2c939591c

Authored by carol15022
Committed by Sergio Oliveira
1 parent 24afe1d3
Exists in trac_indexing

Run tests with setup.py

Signed-off-by: Sergio Oliveira <sergio@tracy.com.br>
Signed-off-by: Thiago Ribeiro <thiagitosouza@hotmail.com>
colab/proxy/trac/migrations/0001_initial.py
... ... @@ -37,7 +37,7 @@ class Migration(migrations.Migration):
37 37 migrations.CreateModel(
38 38 name='Revision',
39 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 41 ('rev', models.TextField(blank=True)),
42 42 ('author', models.TextField(blank=True)),
43 43 ('message', models.TextField(blank=True)),
... ... @@ -47,16 +47,15 @@ class Migration(migrations.Migration):
47 47 ('modified', models.DateTimeField(null=True, blank=True)),
48 48 ],
49 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 53 bases=(models.Model, hitcounter.models.HitCounterModelMixin),
55 54 ),
56 55 migrations.CreateModel(
57 56 name='Ticket',
58 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 59 ('summary', models.TextField(blank=True)),
61 60 ('description_ticket', models.TextField(blank=True)),
62 61 ('milestone', models.TextField(blank=True)),
... ... @@ -75,24 +74,12 @@ class Migration(migrations.Migration):
75 74 ('modified_by', models.TextField(blank=True)),
76 75 ],
77 76 options={
78   - 'verbose_name': 'Attachment',
79   - 'verbose_name_plural': 'Attachment',
  77 + 'verbose_name': 'Ticket',
  78 + 'verbose_name_plural': 'Ticket',
80 79 },
81 80 bases=(models.Model, hitcounter.models.HitCounterModelMixin),
82 81 ),
83 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 83 name='Wiki',
97 84 fields=[
98 85 ('title', models.TextField(serialize=False, primary_key=True)),
... ... @@ -104,21 +91,9 @@ class Migration(migrations.Migration):
104 91 ('user', models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, null=True)),
105 92 ],
106 93 options={
107   - 'verbose_name': 'Attachment',
108   - 'verbose_name_plural': 'Attachment',
  94 + 'verbose_name': 'Wiki',
  95 + 'verbose_name_plural': 'Wiki',
109 96 },
110 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 52 class Revision(models.Model, HitCounterModelMixin):
53 53 update_field = 'created'
54 54 icon_name = 'align-right'
55   - key = models.TextField(blank=True, primary_key=True)
56 55 rev = models.TextField(blank=True)
57 56 author = models.TextField(blank=True)
58 57 message = models.TextField(blank=True)
... ... @@ -66,9 +65,8 @@ class Revision(models.Model, HitCounterModelMixin):
66 65 return u'{} [{}]'.format(self.repository_name, self.rev)
67 66  
68 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 71 def get_absolute_url(self):
74 72 return u'/changeset/{}/{}'.format(self.rev, self.repository_name)
... ... @@ -83,7 +81,6 @@ class Revision(models.Model, HitCounterModelMixin):
83 81 class Ticket(models.Model, HitCounterModelMixin):
84 82 icon_name = 'tag'
85 83 type = 'ticket'
86   - id = models.IntegerField(primary_key=True)
87 84 summary = models.TextField(blank=True)
88 85 description_ticket = models.TextField(blank=True)
89 86 milestone = models.TextField(blank=True)
... ... @@ -113,8 +110,8 @@ class Ticket(models.Model, HitCounterModelMixin):
113 110 )
114 111  
115 112 class Meta:
116   - verbose_name = _('Attachment')
117   - verbose_name_plural = _('Attachment')
  113 + verbose_name = _('Ticket')
  114 + verbose_name_plural = _('Ticket')
118 115  
119 116 def get_absolute_url(self):
120 117 return u'/ticket/{}'.format(self.id)
... ... @@ -147,8 +144,8 @@ class Wiki(Collaboration, HitCounterModelMixin):
147 144 return u'{}\n{}'.format(self.wiki_text, self.collaborators)
148 145  
149 146 class Meta:
150   - verbose_name = _('Attachment')
151   - verbose_name_plural = _('Attachment')
  147 + verbose_name = _('Wiki')
  148 + verbose_name_plural = _('Wiki')
152 149  
153 150 def get_absolute_url(self):
154 151 return u'/wiki/{}'.format(self.title)
... ... @@ -165,20 +162,3 @@ class Wiki(Collaboration, HitCounterModelMixin):
165 162 except User.DoesNotExist:
166 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 162 wiki.collaborators = 'collaborators'
163 163 wiki.created = '1994-11-05T08:15:30-05:00'
164 164 wiki.modified = '1994-11-05T08:15:30-05:00'
165   - from django.conf import settings
166   - print settings.INSTALLED_APPS
167 165 wiki.save()
168 166  
169 167 return wiki
... ...
tests/run.py
... ... @@ -6,7 +6,7 @@ import sys
6 6 os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
7 7 os.environ['COLAB_SETTINGS'] = 'tests/settings.yaml'
8 8 os.environ['COVERAGE_PROCESS_START'] = '.coveragerc'
9   -os.environ['REUSE_DB'] = '0'
  9 +os.environ['REUSE_DB'] = '1'
10 10  
11 11 import django
12 12 import coverage
... ... @@ -14,7 +14,6 @@ import coverage
14 14 from django.test.utils import get_runner
15 15 from django.conf import settings
16 16  
17   -
18 17 def runtests():
19 18 if django.VERSION >= (1, 7, 0):
20 19 django.setup()
... ...
tests/settings.yaml
... ... @@ -64,10 +64,10 @@ ROBOTS_NOINDEX: false
64 64  
65 65 ### Colab proxied apps
66 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  
... ...