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

Skip None value, fixes retrieval of diagnostics #1157

Merged
merged 5 commits into from
Feb 29, 2024

Conversation

jwillemsen
Copy link
Contributor

Fixes diagnostics retrieval issue as part of home-assistant/core#111818

@iMicknl
Copy link
Owner

iMicknl commented Feb 29, 2024

Would it be possible to add your setup.json to the repo as well and add this to our test suite?

Regarding the linting issue, fine by me to disable this rule via a comment in your code.

@jwillemsen
Copy link
Contributor Author

Ok, disabled the rule, added my json to the fixtures/setup directory, is that the correct place?

@iMicknl
Copy link
Owner

iMicknl commented Feb 29, 2024

Apparently we don't have a test yet for the obfuscate feature; but good to add your fixture nevertheless.

@jwillemsen
Copy link
Contributor Author

For the obfuscate feature, the problem is I think this list in the raw data 'cooling': {'d': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, None, None, None, None, None, None, None]

@jwillemsen
Copy link
Contributor Author

Apparently we don't have a test yet for the obfuscate feature; but good to add your fixture nevertheless.

And added a test case for this, without my patch the test fails with

=============================================================================================================================================================================== FAILURES ================================================================================================================================================================================
_________________________________________________________________________________________________________________________________________________________ TestObfucscateSensitive.test_obfuscate_sensitive_data _________________________________________________________________________________________________________________________________________________________

self = <tests.test_obfuscate.TestObfucscateSensitive object at 0x7f404f5bfa10>

    def test_obfuscate_sensitive_data(self):
        input = {'d': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, None, None, None, None, None, None, None]}
>       assert obfuscate_sensitive_data(input) == input

tests/test_obfuscate.py:24: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pyoverkiz/obfuscate.py:73: in obfuscate_sensitive_data
    obfuscate_sensitive_data(val)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

data = None

    def obfuscate_sensitive_data(data: dict[str, Any]) -> JSON:
        """Mask Overkiz JSON data to remove sensitive data"""
        mask_next_value = False
    
>       for key, value in data.items():
E       AttributeError: 'NoneType' object has no attribute 'items'

pyoverkiz/obfuscate.py:31: AttributeError

    * tests/test_obfuscate.py:
@iMicknl iMicknl merged commit 4f96c95 into iMicknl:main Feb 29, 2024
4 checks passed
@iMicknl iMicknl added bug Something isn't working fix and removed bug Something isn't working labels Feb 29, 2024
@jwillemsen jwillemsen deleted the jwi-skipnone branch February 29, 2024 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants