Files
Gainsight/Scripts/workato_antho_testing.py

75 lines
2.1 KiB
Python

"""
This needs to be made into a much smaller node in Workato, so here is a test for it.
"""
input = {"user_email": "hellofriend@newanthology.com"}
mappings = [
# Accreditation Group
{ "uuid": "601eca77-0d33-412f-a9b7-7e2423c77c4f",
"domains" : [ "newanthology.com",
"knowledgestate.edu",
"creighton.edu",
"tc.columbia.edu",
"mstc.edu",
"gvltec.edu"],
"props": "Westmoreland County Community College: Enhanced+",
},
# Ally Group
{
"uuid" : "c84b5100-afd1-47ac-9b95-a6e557d0a8ab",
"domains": [
"newanthology.com",
"knowledgestate.edu",
"gvltec.edu",
"lipscomb.edu",
"dts.edu",
"brazosport.edu",
"lsua.edu",
"fnu.edu",
"lbc.edu",
"csusb.edu",
"laverne.edu",
"desu.edu",
"gwinnetttech.edu",
"musc.edu",
"sentara.edu",
"smu.edu",
"utc.edu",
"uttyler.edu",
"lynchburg.edu",
"alliant.edu",
],
"props": "Another Custom Prop Value: Enhanced",
},
]
def main(input):
email = input["user_email"]
domain = email.split("@")[1]
groups = []
props = []
"""
List Comprehension won't work here because trying to append
will mutate the list. Instead, use a nested for loop
"""
# putput = [tup for tup in mappings if domain in tup[1]]
# print(tup)
# print(f"And here is the group uuid is {putput[0][0]}")
for tup in mappings:
if domain in tup['domains']:
groups.append(str(tup['uuid']))
props.append(str(tup['props']))
# return {"group_list": groups, "prop_list": props}
# print(f"List of properties: {props}")
# print(f"List of groups: {groups}")
# print(x)
# print(y)
groups = str(groups)
groups = groups[0:-1].replace("'",'"')
print(groups[1:-1])
print(type(groups))
if __name__ == "__main__":
main(input)