fix: take care of changed belen_conf keys (#758)

## ℹ️ Description
This PR takes care of the changed belen_conf dictionary.
So extracting special attributes and third category will work again.

- Link to the related issue(s): Issue #757


## 📋 Changes Summary

- changed belen_conf keys from "dimension108" to "ad_attributes" and
"dimension92" to "l3_category_id"

### ⚙️ Type of Change
Select the type(s) of change(s) included in this pull request:
- [x] 🐞 Bug fix (non-breaking change which fixes an issue)
- [ ]  New feature (adds new functionality without breaking existing
usage)
- [ ] 💥 Breaking change (changes that might break existing user setups,
scripts, or configurations)


##  Checklist
Before requesting a review, confirm the following:
- [x] I have reviewed my changes to ensure they meet the project's
standards.
- [x] I have tested my changes and ensured that all tests pass (`pdm run
test`).
- [x] I have formatted the code (`pdm run format`).
- [x] I have verified that linting passes (`pdm run lint`).
- [x] I have updated documentation where necessary.

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
* Updated internal data extraction sources for category and attribute
information to align with current analytics configuration.
  * Updated test suite to reflect configuration changes.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Jens <1742418+1cu@users.noreply.github.com>
This commit is contained in:
Heavenfighter
2026-01-08 22:16:46 +01:00
committed by GitHub
parent 8ab3f50385
commit 066ecc87b8
2 changed files with 24 additions and 24 deletions

View File

@@ -17,7 +17,7 @@ from kleinanzeigen_bot.utils.web_scraping_mixin import Browser, By, Element
class _DimensionsDict(TypedDict):
dimension108:str
ad_attributes:str
class _UniversalAnalyticsOptsDict(TypedDict):
@@ -622,8 +622,8 @@ class TestAdExtractorContent:
web_execute = AsyncMock(return_value = {
"universalAnalyticsOpts": {
"dimensions": {
"dimension92": "",
"dimension108": ""
"l3_category_id": "",
"ad_attributes": ""
}
}
}),
@@ -658,8 +658,8 @@ class TestAdExtractorContent:
web_execute = AsyncMock(return_value = {
"universalAnalyticsOpts": {
"dimensions": {
"dimension92": "",
"dimension108": ""
"l3_category_id": "",
"ad_attributes": ""
}
}
}),
@@ -699,8 +699,8 @@ class TestAdExtractorContent:
web_execute = AsyncMock(return_value = {
"universalAnalyticsOpts": {
"dimensions": {
"dimension92": "",
"dimension108": ""
"l3_category_id": "",
"ad_attributes": ""
}
}
}),
@@ -841,7 +841,7 @@ class TestAdExtractorCategory:
mock_web_execute.return_value = {
"universalAnalyticsOpts": {
"dimensions": {
"dimension108": ""
"ad_attributes": ""
}
}
}
@@ -856,7 +856,7 @@ class TestAdExtractorCategory:
special_atts = {
"universalAnalyticsOpts": {
"dimensions": {
"dimension108": "versand_s:t|color_s:creme|groesse_s:68|condition_s:alright|type_s:accessoires|art_s:maedchen"
"ad_attributes": "versand_s:t|color_s:creme|groesse_s:68|condition_s:alright|type_s:accessoires|art_s:maedchen"
}
}
}
@@ -876,12 +876,12 @@ class TestAdExtractorCategory:
@pytest.mark.asyncio
# pylint: disable=protected-access
async def test_extract_special_attributes_missing_dimension108(self, extractor:AdExtractor) -> None:
"""Test extraction of special attributes when dimension108 key is missing."""
async def test_extract_special_attributes_missing_ad_attributes(self, extractor:AdExtractor) -> None:
"""Test extraction of special attributes when ad_attributes key is missing."""
belen_conf:dict[str, Any] = {
"universalAnalyticsOpts": {
"dimensions": {
# dimension108 key is completely missing
# ad_attributes key is completely missing
}
}
}
@@ -1086,8 +1086,8 @@ class TestAdExtractorDownload:
patch.object(extractor, "web_execute", new_callable = AsyncMock, return_value = {
"universalAnalyticsOpts": {
"dimensions": {
"dimension92": "",
"dimension108": ""
"l3_category_id": "",
"ad_attributes": ""
}
}
}),
@@ -1145,8 +1145,8 @@ class TestAdExtractorDownload:
patch.object(extractor, "web_execute", new_callable = AsyncMock, return_value = {
"universalAnalyticsOpts": {
"dimensions": {
"dimension92": "",
"dimension108": ""
"l3_category_id": "",
"ad_attributes": ""
}
}
}),
@@ -1206,8 +1206,8 @@ class TestAdExtractorDownload:
patch.object(extractor, "web_execute", new_callable = AsyncMock, return_value = {
"universalAnalyticsOpts": {
"dimensions": {
"dimension92": "",
"dimension108": ""
"l3_category_id": "",
"ad_attributes": ""
}
}
}),
@@ -1262,8 +1262,8 @@ class TestAdExtractorDownload:
patch.object(extractor, "web_execute", new_callable = AsyncMock, return_value = {
"universalAnalyticsOpts": {
"dimensions": {
"dimension92": "",
"dimension108": ""
"l3_category_id": "",
"ad_attributes": ""
}
}
}),