Skip to content

Commit 18c9646

Browse files
author
kobo-bot[bot]
committed
Merge branch 'release/2.025.37' into release/2.025.43
2 parents f1f0781 + fb8596c commit 18c9646

File tree

6 files changed

+22
-17
lines changed

6 files changed

+22
-17
lines changed

jsapp/js/api/models/hook.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export interface Hook {
2929
/** @nullable */
3030
payload_template?: string | null
3131
readonly pending_count: number
32-
settings: HookSettings
33-
subset_fields: string[]
32+
settings?: HookSettings
33+
subset_fields?: string[]
3434
readonly success_count: number
3535
readonly uid: string
3636
readonly url: string

kobo/apps/hook/serializers/v2/hook.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@
2323

2424
class HookSerializer(serializers.ModelSerializer):
2525

26-
payload_template = serializers.CharField(required=False, allow_blank=True,
27-
allow_null=True)
26+
payload_template = serializers.CharField(
27+
required=False, allow_blank=True, allow_null=True
28+
)
2829

29-
settings = JSONFieldWithSchemaField(SettingsField)
30-
subset_fields = ListFieldWithSchemaField(SubsetFieldsField)
30+
settings = JSONFieldWithSchemaField(SettingsField, required=False)
31+
subset_fields = ListFieldWithSchemaField(SubsetFieldsField, required=False)
3132

3233
class Meta:
3334
model = Hook

kobo/apps/hook/tests/test_api_hook.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ def test_anonymous_access(self):
6363
def test_create_hook(self):
6464
self._create_hook()
6565

66+
def test_create_minimal_hook(self):
67+
self._create_hook(minimal=True)
68+
6669
def test_editor_access(self):
6770
hook = self._create_hook()
6871

kobo/apps/hook/utils/tests/mixins.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,23 @@ def _create_hook(self, return_response_only=False, **kwargs):
2828
self._add_submissions()
2929

3030
url = reverse('hook-list', args=(self.asset.uid,))
31+
3132
data = {
3233
'name': kwargs.get('name', 'some external service with token'),
3334
'endpoint': kwargs.get('endpoint', 'http://external.service.local/'),
34-
'settings': kwargs.get(
35-
'settings', {'custom_headers': {'X-Token': '1234abcd'}}
36-
),
37-
'export_type': format_type,
38-
'active': kwargs.get('active', True),
39-
'subset_fields': kwargs.get('subset_fields', []),
40-
'payload_template': kwargs.get('payload_template', None),
4135
}
4236

37+
if not kwargs.get('minimal', False):
38+
data.update({
39+
'settings': kwargs.get(
40+
'settings', {'custom_headers': {'X-Token': '1234abcd'}}
41+
),
42+
'active': kwargs.get('active', True),
43+
'export_type': format_type,
44+
'subset_fields': kwargs.get('subset_fields', []),
45+
'payload_template': kwargs.get('payload_template', None),
46+
})
47+
4348
response = self.client.post(url, data, format='json')
4449
if return_response_only:
4550
return response

static/openapi/schema_v2.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15360,8 +15360,6 @@
1536015360
"logs_url",
1536115361
"name",
1536215362
"pending_count",
15363-
"settings",
15364-
"subset_fields",
1536515363
"success_count",
1536615364
"uid",
1536715365
"url"

static/openapi/schema_v2.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11076,8 +11076,6 @@ components:
1107611076
- logs_url
1107711077
- name
1107811078
- pending_count
11079-
- settings
11080-
- subset_fields
1108111079
- success_count
1108211080
- uid
1108311081
- url

0 commit comments

Comments
 (0)