Skip to content
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

Can't create dialogs through using compressed ids #15434

Closed
imtayadeway opened this issue Jun 22, 2017 · 1 comment
Closed

Can't create dialogs through using compressed ids #15434

imtayadeway opened this issue Jun 22, 2017 · 1 comment
Assignees

Comments

@imtayadeway
Copy link
Contributor

When running the following test in a non-0-region (taken from the service dialog specs, modified to use compressed ids in the request body), it fails:

      it 'POST /api/service_dialogs/:id updates a service dialog' do
        api_basic_authorize collection_action_identifier(:service_dialogs, :edit)
        dialog_tab = dialog.dialog_tabs.first
        dialog_group = dialog_tab.dialog_groups.first
        dialog_field = dialog_group.dialog_fields.first

        updated_dialog = {
          'label'   => 'updated label',
          'content' => {
            'dialog_tabs' => [
              'id'            => dialog_tab.compressed_id,
              'label'         => 'updated tab label',
              'dialog_groups' => [
                {
                  'id'            => dialog_group.compressed_id,
                  'dialog_fields' => [
                    { 'id' => dialog_field.compressed_id }
                  ]
                }
              ]
            ]
          }
        }

        expected = {
          'href'  => a_string_including(service_dialogs_url(dialog.id)),
          'id'    => dialog.compressed_id,
          'label' => 'updated label'
        }

        expect do
          run_post(service_dialogs_url(dialog.id), gen_request(:edit, updated_dialog))
          dialog.reload
        end.to change(dialog, :content)
        expect(response).to have_http_status(:ok)
        expect(response.parsed_body).to include(expected)
      end

...with the error:

error" => {"kind"=>"bad_request", "message"=>"Failed to update service dialog - Couldn't find DialogTab with 'id'=10r102", "klass"=>"Api::BadRequestError", "backtrace"=>"/Users/jilliantullo/code/manageiq/app/controllers/api/service_dialogs_controller.rb:32:in `rescue in edit_resource'\n/Users/jilliantullo/code/manageiq/app/controllers/api/service_dialogs_controller.rb:28

I'd expect this to work - i.e. for dialogs to be assembled from components referred to via compressed id.

@imtayadeway
Copy link
Contributor Author

@miq-bot add-label api, bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants