@@ -141,3 +141,55 @@ def test_download_only(hawkbit, config, assign_bundle):
141141
142142 # check last status message
143143 assert 'File checksum OK.' in status [0 ]['messages' ]
144+
145+ def test_download_only_with_auth_header (hawkbit , adjust_config , assign_bundle ,
146+ download_without_auth_headers_port ):
147+ """
148+ Test that rauc-hawkbit-updater fails when sending authentication header to external storage
149+ provider with send_download_authentication=true.
150+ """
151+ config = adjust_config ({'client' : {
152+ 'send_download_authentication' : 'true' ,
153+ 'hawkbit_server' : f'{ hawkbit .host } :{ download_without_auth_headers_port } '
154+ }})
155+ assign_bundle (params = {'type' : 'downloadonly' })
156+
157+ out , err , exitcode = run (f'rauc-hawkbit-updater -c "{ config } " -r' )
158+ assert 'Start downloading' in out
159+ assert 'hawkBit requested to skip installation, not invoking RAUC yet.' in out
160+ assert 'Download failed: HTTP request failed: 401' in err
161+ assert exitcode == 1
162+
163+ status = hawkbit .get_action_status ()
164+
165+ assert status [0 ]['type' ] == 'error'
166+ # check last status message
167+ assert 'Download failed: HTTP request failed: 401' in status [0 ]['messages' ]
168+
169+ def test_download_only_without_auth_header (hawkbit , adjust_config , assign_bundle ,
170+ download_without_auth_headers_port ):
171+ """
172+ Test that rauc-hawkbit-updater does not send authentication header with
173+ send_download_authentication=false.
174+ Test that rauc-hawkbit-updater succeeds when not sending authentication header to external
175+ storage provider with send_download_authentication=false.
176+ """
177+ config = adjust_config ({'client' : {
178+ 'send_download_authentication' : 'false' ,
179+ 'hawkbit_server' : f'{ hawkbit .host } :{ download_without_auth_headers_port } '
180+ }})
181+ assign_bundle (params = {'type' : 'downloadonly' })
182+
183+ out , err , exitcode = run (f'rauc-hawkbit-updater -c "{ config } " -r' )
184+ assert 'Start downloading' in out
185+ assert 'hawkBit requested to skip installation, not invoking RAUC yet.' in out
186+ assert 'Download complete' in out
187+ assert 'File checksum OK' in out
188+ assert err == ''
189+ assert exitcode == 0
190+
191+ status = hawkbit .get_action_status ()
192+
193+ assert status [0 ]['type' ] == 'downloaded'
194+ # check last status message
195+ assert 'File checksum OK.' in status [0 ]['messages' ]
0 commit comments