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
storage service edit #1216
storage service edit #1216
Conversation
@bdunne hi, this is ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great. just that one change
Also, is there a way to add a spec here? |
should I use |
2fb6b98
to
c2083d1
Compare
|
@OrGur1987 good point. you can't test that the records have been modified because this is just a request for the provider. Yes, base your tests upon those. |
c2083d1
to
06510f2
Compare
added an edit spec to |
require 'byebug' | ||
byebug | ||
provider = FactoryBot.create(:ems_autosde, :name => 'Autosde') | ||
storage_service = FactoryBot.create("ManageIQ::Providers::Autosde::StorageManager::StorageService", :name => 'test_service1', :ext_management_system => provider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
storage_service = FactoryBot.create("ManageIQ::Providers::Autosde::StorageManager::StorageService", :name => 'test_service1', :ext_management_system => provider) | |
storage_service = FactoryBot.create(:autosde_storage_manager, :ext_management_system => provider) |
also noticed that others use :storage_service
, not sure if that works for you.
You could probably put the provider
and storage_service
into a let() {}
at the top of this file to reduce some of this duplication... but that is up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracted provider
to let()
.
extracting storage_service
didn't quite work out with the delete
and get
specs..
in the edit
spec, for some reason when I use FactoryBot.create(:storage_service, ... )
the service does not support update
, but it does when I use FactoryBot.create("ManageIQ::Providers::Autosde::StorageManager::StorageService",...)
.
do u have any idea why? maybe it references the core repo storage_service
model and not the provider's one?
it supposedly doesn't support create
and delete
as well, but those spec do pass..
83: context 'Storage Services edit action' do
84: it "PUT /api/storage_services/:id'" do
85: storage_service1 = FactoryBot.create("ManageIQ::Providers::Autosde::StorageManager::StorageService", :name => 'test_service1', :ext_management_system => provider)
86: storage_service2 = FactoryBot.create(:storage_service, :name => 'test_service1', :ext_management_system => provider)
87:
88: require 'byebug'
89: byebug
90:
=> 91: api_basic_authorize('storage_service_edit')
92: put(api_storage_service_url(nil, storage_service))
93:
94:
95: expect(response.parsed_body["message"]).to include("Updating")
96: expect(response).to have_http_status(:ok)
97: end
98: end
99:
100: end
(byebug) storage_service1.supports_update?
true
(byebug) storage_service2.supports_update?
false
(byebug) storage_service2.supports_create?
false
(byebug) storage_service2.supports_delete?
false
(byebug) storage_service1.supports_delete?
true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry.
We tend to use stub_supports
to ensure that you get the expected supports?
.
In the far far future, we would like to change all these tests to use a generic providers with a bunch of expectations on them.
In your example, I know you specified the correct :provider
for service2
, but the class of storage_service
is not right. You would need to use a factory like :autosde_storage_manager
.
But stub_supports
on the storage_service2
would probably get your needs met if that factory does not work for you.
@OrGur1987 This looks great. Just one or two tweaks and we can get it in right away. Thanks for doing this |
06510f2
to
519a083
Compare
@kbrock is spec ok like that? |
@kbrock |
@OrGur1987 thanks for the ping. I'll leave this tab open and hope it does not slip through the cracks again. Could you see my notes around the class of the Not sure why the factory is a sticking point for me |
938214a
to
55bc611
Compare
55bc611
to
004d17c
Compare
Checked commit Autosde@004d17c with ruby 2.6.10, rubocop 1.28.2, haml-lint 0.35.0, and yamllint |
@kbrock |
belongs to issue: ManageIQ/manageiq-ui-classic#8728
depends upon:
adds editing/update option to storage service controller and app yaml