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

Send auth headers when de registering a product on SCC #1271

Merged
merged 2 commits into from
Jan 14, 2025
Merged
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 engines/scc_proxy/lib/scc_proxy/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def scc_deactivate_product
elsif @system.hybrid? && @product.extension?
# check if product is on SCC and
# if it is -> de-activate it
scc_hybrid_system_activations = SccProxy.get_scc_activations(headers, @system)
scc_hybrid_system_activations = SccProxy.get_scc_activations(request.headers, @system)
if scc_hybrid_system_activations.map { |act| act['service']['product']['id'] == @product.id }.present?
# if product is found on SCC, regardless of the state
# it is OK to remove it from SCC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,15 @@
let(:scc_systems_activations_url) { 'https://scc.suse.com/connect/systems/activations' }

before do
stub_request(:get, scc_systems_activations_url).to_return(status: 401, body: "{\"error\": \"Error\'\"}", headers: {})
stub_request(:get, scc_systems_activations_url).to_return(status: 401, body: "{\"error\": \"Error\'\"}", headers: headers)
allow(SccProxy).to receive(:headers)
delete url, params: payload, headers: headers
end

it 'reports an error' do
data = JSON.parse(response.body)
expect(data['error']).to eq("{\"error\": \"Error'\"}")
expect(SccProxy).to have_received(:headers).with(headers['HTTP_AUTHORIZATION'], nil)
end
end

Expand Down
Loading