jeudi 22 novembre 2018

Robotframework Getting array value from dictionary

Im having trouble retrieving a value from a dictionary in my robotframework test.

Right now I'm doing a query using the LDAP3 library that returns the following dictionary:

{'cn': ['Robotframework, U (User8072)'], 'dn': ['user=12345 OU=1,o=company,c=com '], 'uid': ['RobotframeworkU8072']}

What happens here is that the LDAP lib I'm using returns all the values as an array inside a dictionary item which means I can't get the value by using:

Dictionary Should Contain Item|${var}|uid|RobotframeworkU8072

Right now the only way I can get this to work is using the following which passes the test:

${test2}|Get From Dictionary|${test}|uid

${test3}|Get From List|${test2}|0

Should Be Equal|${test3}|RobotframeworkU8072

But is it really that complicated? Isn't there an easier way to do this?

Aucun commentaire:

Enregistrer un commentaire