Skip to content

Add additional failing to_h sequence_of test#46

Closed
adfoster-r7 wants to merge 5 commits intolemontree55:masterfrom
adfoster-r7:add-sequence-of-test-failure
Closed

Add additional failing to_h sequence_of test#46
adfoster-r7 wants to merge 5 commits intolemontree55:masterfrom
adfoster-r7:add-sequence-of-test-failure

Conversation

@adfoster-r7
Copy link
Contributor

@adfoster-r7 adfoster-r7 commented Jan 5, 2025

I believe this is a separate bug to: #45 - so I thought I'd create a separate example test failure snippet. Let me know if I should close this off or raise a separate issue 💯

Current to_h output:

{
  LdapMessage: {
    message_id: 2,
    protocol_op: {
      # TODO: Wrong
      "": ["ldap://example.com/ou=People,dc=example,dc=com"],
      diagnostic_message:
        "0000202B: RefErr: DSID-0310082F, data 0, 1 access points\n\tref 1: 'example.com'\n\x00",
      matched_dn: "",
      result_code: "referral"
    }
  }
}

Expected - Key not blank:

expected = {
  LdapMessage: {
    message_id: 2,
    protocol_op: {
      # key present:
      referral: ["ldap://example.com/ou=People,dc=example,dc=com"],
      diagnostic_message:
        "0000202B: RefErr: DSID-0310082F, data 0, 1 access points\n\tref 1: 'example.com'\n\x00",
      matched_dn: "",
      result_code: "referral"
    }
  }
}

Wireshark example:

image

`model` helper defines a name for an embedded model, but that name was not used. Now, this model is identified using this name in outer model.
This avoid clash when embedding a same model more than once.
Choice content in resultant hash is no more the value of the chosen item,
but a hash which key is the item name associated with item value.
),
ldap_dn(:matched_dn),
ldap_string(:diagnostic_message),
wrapper(model(:referral, Referral), implicit: 3, optional: true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This gets serialized incorrectly as:

                "": ["ldap://example.com/ou=People,dc=example,dc=com"],

message_id: 2,
protocol_op: {
# TODO: Wrong
"": ["ldap://example.com/ou=People,dc=example,dc=com"],
Copy link
Contributor Author

@adfoster-r7 adfoster-r7 Jan 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected:

Suggested change
"": ["ldap://example.com/ou=People,dc=example,dc=com"],
"referral": ["ldap://example.com/ou=People,dc=example,dc=com"],

lemontree55 and others added 2 commits January 5, 2025 12:11
In #private_to_h, do not take root element when my_element is a Model, but
transform the model itsel to a Hash. Then,
replace upper key in Hash by model name in current model.
@adfoster-r7 adfoster-r7 force-pushed the add-sequence-of-test-failure branch from e1c249b to fca70f4 Compare January 6, 2025 21:36
@adfoster-r7
Copy link
Contributor Author

adfoster-r7 commented Jan 6, 2025

Issue in the PR description is fixed by #44 - will close 👍

@adfoster-r7 adfoster-r7 closed this Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants