Tufin / pytos

A Python SDK for Tufin Orchestration Suite
https://www.tufin.com
Apache License 2.0
55 stars 21 forks source link

get_app_by_name() returns only first item from application list #9

Closed Lok33 closed 6 years ago

Lok33 commented 6 years ago

The Tufin API returns a list of applications by name, if you call https:///securechangeworkflow/api/secureapp/repository/applications?name=. The corresponding function in pytos.secureapp.helpers.get_app_by_name() will only return the first item of that list. Say we got applications "amapp" and "map app" and one wants to obtain "map app" from SecureApp by calling get_app_by_name("map app") and verify the result. Calling https:///securechangeworkflow/api/secureapp/repository/applications?name=map%20app will return a list of applications including "amapp" and "map app" in that order. Since get_app_by_name will only return the first item, the returned application is "amapp" which leads to the assumption that "map app" does not exist in SecureApp yet which is not correct.

This issue consequently occurrs when calling functions using get_app_by_name implicitly like get_network_obejcts_list_for_app_name.

funkycode commented 6 years ago

Hey, In general there is difference between what API actually does and returns vs the functionality of the library. The function works correctly that it returns only single application. Though you are correct that there is bug - as it should return correct application. We will fix it - so library searches for exact name from the list of application we got from API. Probably API uses 'LIKE' underneath of filtration instead of '=' and that causes the problem.

tgratzi commented 6 years ago

Added