Skip to content

Commit 8c563bf

Browse files
feat(spp_dci_client): drop unsupported Basic Authentication option
Basic auth was a non-functional stub: the auth_type selection offered it, but get_headers() raised 'not yet implemented' and no username/password fields existed, so picking it was a dead end. Remove the 'basic' selection option and the dead handler branch. Tests covering the stub are removed; the sender-id constraint test now exercises bearer auth instead.
1 parent 800189b commit 8c563bf

4 files changed

Lines changed: 4 additions & 20 deletions

File tree

spp_dci_client/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"name": "OpenSPP DCI Client",
44
"summary": "Base DCI client infrastructure with OAuth2 and data source management",
5-
"version": "19.0.2.0.0",
5+
"version": "19.0.2.0.1",
66
"category": "OpenSPP/Integration",
77
"author": "OpenSPP.org",
88
"website": "https://github.com/OpenSPP/OpenSPP2",

spp_dci_client/models/data_source.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class DCIDataSource(models.Model):
4848
[
4949
("none", "None"),
5050
("bearer", "Bearer Token"),
51-
("basic", "Basic Authentication"),
5251
("oauth2", "OAuth2"),
5352
],
5453
default="oauth2",
@@ -486,9 +485,6 @@ def get_headers(self, force_refresh_token=False):
486485
if not self.bearer_token:
487486
raise UserError(_("Bearer token is not configured for this data source."))
488487
headers["Authorization"] = f"Bearer {self.bearer_token}"
489-
elif self.auth_type == "basic":
490-
# Basic auth would require username/password fields (not in current spec)
491-
raise UserError(_("Basic authentication is not yet implemented."))
492488

493489
return headers
494490

spp_dci_client/tests/test_data_source.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,15 @@ def test_oauth2_secret_set_via_display_field_on_write(self):
238238

239239
def test_sender_id_required_for_auth(self):
240240
"""Test sender ID is required when auth_type is not 'none'"""
241-
# Should fail for basic auth without sender_id
241+
# Should fail for bearer auth without sender_id
242242
with self.assertRaises(ValidationError) as cm:
243243
self.DataSource.create(
244244
{
245245
"name": "Test CRVS",
246246
"code": "test_crvs",
247247
"base_url": "https://crvs.example.org/api",
248-
"auth_type": "basic",
248+
"auth_type": "bearer",
249+
"bearer_token": "tok",
249250
}
250251
)
251252
self.assertIn("sender id", str(cm.exception).lower())

spp_dci_client/tests/test_data_source_http.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,6 @@ def test_get_headers_bearer(self):
142142
)
143143
self.assertEqual(ds.get_headers()["Authorization"], "Bearer btok")
144144

145-
def test_get_headers_basic_not_implemented(self):
146-
ds = self.DataSource.create(
147-
{
148-
"name": "Basic DS",
149-
"code": "basic_ds",
150-
"base_url": "https://dci.example.org/api",
151-
"auth_type": "basic",
152-
"our_sender_id": "openspp.test",
153-
}
154-
)
155-
with self.assertRaises(UserError):
156-
ds.get_headers()
157-
158145
# --- test_connection -----------------------------------------------------
159146

160147
def test_connection_success_activates(self):

0 commit comments

Comments
 (0)