Skip to content

Commit e35f8f1

Browse files
chore: Remove populate and fix various dredd tests (#6506)
1 parent f5a429f commit e35f8f1

File tree

9 files changed

+77
-112
lines changed

9 files changed

+77
-112
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,4 @@ generated/
5858

5959
docker-compose.override.yml
6060
celerybeat-schedule.*
61+
.coverage

app/factories/role.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
import app.factories.common as common
44
from app.models.role import db, Role
5+
from app.models.user import ORGANIZER
56

67

78
class RoleFactory(factory.alchemy.SQLAlchemyModelFactory):
89
class Meta:
910
model = Role
1011
sqlalchemy_session = db.session
1112

12-
name = common.string_
13+
name = ORGANIZER
1314
title_name = common.string_

docs/api/blueprint/custom_system_roles.apib

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ Create a new custom system role using a name.
121121

122122
## Custom System Roles Details [/v1/custom-system-roles/{custom_system_role_id}]
123123
+ Parameters
124-
+ custom_system_role_id: 2 (integer) - ID of the custom system role in the form of an integer.
124+
+ custom_system_role_id: 1 (integer) - ID of the custom system role in the form of an integer.
125125

126126
### Get Details [GET]
127127
Get a single custom system role.
@@ -141,25 +141,25 @@ Get a single custom system role.
141141
"version": "1.0"
142142
},
143143
"links": {
144-
"self": "/v1/custom-system-roles/2"
144+
"self": "/v1/custom-system-roles/1"
145145
},
146146
"data": {
147147
"relationships": {
148148
"panel-permissions": {
149149
"links": {
150-
"self": "/v1/custom-system-roles/2/relationships/panel-permissions",
151-
"related": "/v1/custom-system-roles/2/panel-permissions"
150+
"self": "/v1/custom-system-roles/1/relationships/panel-permissions",
151+
"related": "/v1/custom-system-roles/1/panel-permissions"
152152
}
153153
}
154154
},
155155
"type": "custom-system-role",
156156
"links": {
157-
"self": "/v1/custom-system-roles/2"
157+
"self": "/v1/custom-system-roles/1"
158158
},
159159
"attributes": {
160160
"name": "Marketer"
161161
},
162-
"id": "2"
162+
"id": "1"
163163
}
164164
}
165165

@@ -183,7 +183,7 @@ Update a single custom system role.
183183
"name": "Manager"
184184
},
185185
"type": "custom-system-role",
186-
"id": "2"
186+
"id": "1"
187187
}
188188
}
189189
+ Response 200 (application/vnd.api+json)
@@ -193,25 +193,25 @@ Update a single custom system role.
193193
"version": "1.0"
194194
},
195195
"links": {
196-
"self": "/v1/custom-system-roles/2"
196+
"self": "/v1/custom-system-roles/1"
197197
},
198198
"data": {
199199
"relationships": {
200200
"panel-permissions": {
201201
"links": {
202-
"self": "/v1/custom-system-roles/2/relationships/panel-permissions",
203-
"related": "/v1/custom-system-roles/2/panel-permissions"
202+
"self": "/v1/custom-system-roles/1/relationships/panel-permissions",
203+
"related": "/v1/custom-system-roles/1/panel-permissions"
204204
}
205205
}
206206
},
207207
"type": "custom-system-role",
208208
"links": {
209-
"self": "/v1/custom-system-roles/2"
209+
"self": "/v1/custom-system-roles/1"
210210
},
211211
"attributes": {
212212
"name": "Manager"
213213
},
214-
"id": "2"
214+
"id": "1"
215215
}
216216
}
217217

docs/api/blueprint/panel_permissions.apib

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,11 @@ Create a new panel permission using a name.
247247

248248
{
249249
"links": {
250-
"self": "/v1/panel-permissions/11"
250+
"self": "/v1/panel-permissions/1"
251251
},
252252
"data": {
253253
"links": {
254-
"self": "/v1/panel-permissions/11"
254+
"self": "/v1/panel-permissions/1"
255255
},
256256
"id": "11",
257257
"attributes": {
@@ -261,8 +261,8 @@ Create a new panel permission using a name.
261261
"relationships": {
262262
"custom-system-roles": {
263263
"links": {
264-
"related": "/v1/panel-permissions/11/custom-system-roles",
265-
"self": "/v1/panel-permissions/11/relationships/custom-system-roles"
264+
"related": "/v1/panel-permissions/1/custom-system-roles",
265+
"self": "/v1/panel-permissions/1/relationships/custom-system-roles"
266266
}
267267
}
268268
},
@@ -275,7 +275,7 @@ Create a new panel permission using a name.
275275

276276
## Panel Permission Details [/v1/panel-permissions/{panel_permission_id}]
277277
+ Parameters
278-
+ panel_permission_id: 10 (integer) - ID of the panel permission in the form of an integer.
278+
+ panel_permission_id: 1 (integer) - ID of the panel permission in the form of an integer.
279279

280280
### Get Details [GET]
281281
Get a single panel permission.
@@ -292,11 +292,11 @@ Get a single panel permission.
292292

293293
{
294294
"links": {
295-
"self": "/v1/panel-permissions/10"
295+
"self": "/v1/panel-permissions/1"
296296
},
297297
"data": {
298298
"links": {
299-
"self": "/v1/panel-permissions/10"
299+
"self": "/v1/panel-permissions/1"
300300
},
301301
"id": "10",
302302
"attributes": {
@@ -306,8 +306,8 @@ Get a single panel permission.
306306
"relationships": {
307307
"custom-system-roles": {
308308
"links": {
309-
"related": "/v1/panel-permissions/10/custom-system-roles",
310-
"self": "/v1/panel-permissions/10/relationships/custom-system-roles"
309+
"related": "/v1/panel-permissions/1/custom-system-roles",
310+
"self": "/v1/panel-permissions/1/relationships/custom-system-roles"
311311
}
312312
}
313313
},
@@ -340,30 +340,30 @@ Get a single panel permission.
340340
"panel-name": "contents"
341341
},
342342
"type": "panel-permission",
343-
"id": "10"
343+
"id": "1"
344344
}
345345
}
346346

347347
+ Response 200 (application/vnd.api+json)
348348

349349
{
350350
"links": {
351-
"self": "/v1/panel-permissions/10"
351+
"self": "/v1/panel-permissions/1"
352352
},
353353
"data": {
354354
"links": {
355-
"self": "/v1/panel-permissions/10"
355+
"self": "/v1/panel-permissions/1"
356356
},
357-
"id": "10",
357+
"id": "1",
358358
"attributes": {
359359
"can-access": true,
360360
"panel-name": "contents"
361361
},
362362
"relationships": {
363363
"custom-system-roles": {
364364
"links": {
365-
"related": "/v1/panel-permissions/10/custom-system-roles",
366-
"self": "/v1/panel-permissions/10/relationships/custom-system-roles"
365+
"related": "/v1/panel-permissions/1/custom-system-roles",
366+
"self": "/v1/panel-permissions/1/relationships/custom-system-roles"
367367
}
368368
}
369369
},

docs/api/blueprint/user/user_permissions.apib

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ To create or modify any data of this data layer, you will need admin access. How
1111
| `unverified-user` | allow for unverified user if set to true | boolean | - |
1212
| `anonymous-user` | allow for ananymous user if set to true | boolean | **yes** |
1313

14-
## User permission Collection [/v1/user-permissions{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
14+
## User Permission Collection [/v1/user-permissions{?page%5bsize%5d,page%5bnumber%5d,sort,filter}]
1515
+ Parameters
1616
+ page%5bsize%5d (optional, integer, `10`) - Maximum number of resources in a single paginated response.
1717
+ page%5bnumber%5d (optional, integer, `2`) - Page number to fetched for the paginated response.
@@ -106,7 +106,7 @@ To create or modify any data of this data layer, you will need admin access. How
106106
"anonymous-user": "false"
107107
},
108108
"type": "user-permission",
109-
"id": "3",
109+
"id": "1",
110110
"links": {
111111
"self": "/v1/user-permissions/3"
112112
}
@@ -122,7 +122,7 @@ To create or modify any data of this data layer, you will need admin access. How
122122

123123
## User Permission Details [/v1/user-permissions/{id}]
124124
+ Parameters
125-
+ id: 3 (integer) - ID of the page in the form of an integer
125+
+ id: 1 (integer) - ID of the page in the form of an integer
126126

127127
### Get User Permission Details [GET]
128128
Get a single resource.
@@ -147,16 +147,16 @@ Get a single resource.
147147
"anonymous-user": "false"
148148
},
149149
"type": "user-permission",
150-
"id": "3",
150+
"id": "1",
151151
"links": {
152-
"self": "/v1/user-permissions/3"
152+
"self": "/v1/user-permissions/1"
153153
}
154154
},
155155
"jsonapi": {
156156
"version": "1.0"
157157
},
158158
"links": {
159-
"self": "/v1/user-permissions/3"
159+
"self": "/v1/user-permissions/1"
160160
}
161161
}
162162

@@ -183,7 +183,7 @@ Update a single resource by `id`.
183183
"anonymous-user": "false"
184184
},
185185
"type": "user-permission",
186-
"id": "3"
186+
"id": "1"
187187
}
188188
}
189189

@@ -201,14 +201,14 @@ Update a single resource by `id`.
201201
"type": "user-permission",
202202
"id": "3",
203203
"links": {
204-
"self": "/v1/user-permissions/3"
204+
"self": "/v1/user-permissions/1"
205205
}
206206
},
207207
"jsonapi": {
208208
"version": "1.0"
209209
},
210210
"links": {
211-
"self": "/v1/user-permissions/3"
211+
"self": "/v1/user-permissions/1"
212212
}
213213
}
214214

dredd.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ timestamp: false
2323
silent: false
2424
path: []
2525
hooks-worker-timeout: 11000
26-
hooks-worker-connect-timeout: 5000
27-
hooks-worker-connect-retry: 500
26+
hooks-worker-connect-timeout: 10000
27+
hooks-worker-connect-retry: 1000
2828
hooks-worker-after-connect-wait: 100
2929
hooks-worker-term-timeout: 5000
3030
hooks-worker-term-retry: 500

tests/all/integration/setup_database.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from app.models import db
88
from app.models.setting import Environment
99
from app.settings import set_settings
10-
from populate_db import populate
1110

1211
_basedir = os.path.abspath(os.path.dirname(__file__))
1312

@@ -22,7 +21,6 @@ def create_app():
2221
celery.conf.update(app.config)
2322
with app.test_request_context():
2423
db.create_all()
25-
populate()
2624
set_settings(secret='super secret key', app_name='Open Event', app_environment=Environment.TESTING)
2725

2826
return app.test_client()

tests/all/integration/test_migrations.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from tests.all.integration.utils import OpenEventTestCase
33
from tests.all.integration.setup_database import Setup
44
from app.views.healthcheck import check_migrations
5+
from populate_db import populate
56

67

78
class TestMigrations(OpenEventTestCase):
@@ -14,3 +15,9 @@ def test_migrations(self):
1415
with app.test_request_context():
1516
result = check_migrations().split(',')
1617
self.assertEqual(result[0], 'success')
18+
19+
def test_populate(self):
20+
"""Method to test populate command"""
21+
22+
with app.test_request_context():
23+
populate()

0 commit comments

Comments
 (0)