Skip to content

[DINGO-1663] Remove all references to targets from ZAS #323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/zendesk_apps_support/app_requirement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class AppRequirement
CUSTOM_OBJECTS_KEY = 'custom_objects'
CUSTOM_OBJECTS_TYPE_KEY = 'custom_object_types'
CUSTOM_OBJECTS_RELATIONSHIP_TYPE_KEY = 'custom_object_relationship_types'
TYPES = %w[automations channel_integrations custom_objects macros targets views ticket_fields
TYPES = %w[automations channel_integrations custom_objects macros views ticket_fields
triggers user_fields organization_fields webhooks].freeze
end
end
19 changes: 13 additions & 6 deletions spec/bookmarks_app/requirements.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"targets": {
"jira_story_target": {
"title": "blah",
"type": "jira_target",
"active": true,
"target_url": "http://example.org"
"webhooks": {
"new_webhook_1": {
"endpoint": "https://webhook.site/81a0f086-7a95-4654-b224-534c3a5bd319",
"http_method": "GET",
"name": "App Created Webhook 1",
"title": "my webhook",
"description": "Webhook for my really sweet app",
"request_format": "json",
"status": "active",
"signing_secret": {
"secret": "pvXR0btAdXdFazX8TPRqbGHZJFGmUs6pqAIKR46REk0",
"algorithm": "SHA256"
}
}
},

Expand Down
19 changes: 13 additions & 6 deletions spec/validations/fixture/requirements.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"targets": {
"jira_story_target": {
"title": "blah",
"type": "jira_target",
"active": true,
"target_url": "http://example.org"
"webhooks": {
"new_webhook_1": {
"endpoint": "https://webhook.site/81a0f086-7a95-4654-b224-534c3a5bd319",
"http_method": "GET",
"name": "App Created Webhook 1",
"title": "my webhook",
"description": "Webhook for my really sweet app",
"request_format": "json",
"status": "active",
"signing_secret": {
"secret": "pvXR0btAdXdFazX8TPRqbGHZJFGmUs6pqAIKR46REk0",
"algorithm": "SHA256"
}
}
},

Expand Down
13 changes: 10 additions & 3 deletions spec/validations/requirements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
end

context 'a requirement field missing a "key"' do
let(:requirements_string) { JSON.generate('targets' => { 'abc' => {} }) }
let(:requirements_string) { JSON.generate('webhooks' => { 'abc' => {} }) }

it 'creates an error for missing required fields' do
expect(errors.first.key).to eq(:missing_required_fields)
Expand Down Expand Up @@ -172,10 +172,10 @@
end

context 'many requirements are lacking required fields' do
let(:requirements_string) { JSON.generate('targets' => { 'abc' => {}, 'xyz' => {} }) }
let(:requirements_string) { JSON.generate('webhooks' => { 'abc' => {}, 'xyz' => {} }) }

it 'creates an error for each of them' do
expect(errors.size).to eq(2)
expect(errors.size).to eq(10)
end
end

Expand All @@ -187,6 +187,13 @@
end
end

context 'there is a targets requirement type' do
let(:requirements_string) { JSON.generate('targets' => { 'abc' => {}, 'xyz' => {} }) }
it 'creates an error' do
expect(errors.first.key).to eq(:invalid_requirements_types)
end
end

context 'there are duplicate requirements' do
let(:requirements_string) { '{ "a": { "b": 1, "b": 2 }}' }

Expand Down