Skip to content

Instantly share code, notes, and snippets.

@mford22392
Created April 16, 2020 16:11
Show Gist options
  • Save mford22392/fb1dd671c4c1560e6fb8f7dfa191f22e to your computer and use it in GitHub Desktop.
Save mford22392/fb1dd671c4c1560e6fb8f7dfa191f22e to your computer and use it in GitHub Desktop.
from services.weighting_service import WeightingService
from tests.unit.test_utility import sort_keys, set_data
def test_default():
influencer_answer = "I want to go back to school, and I know what type of program, degree, or certificate I want to complete"
apps_to_finish = True
completed_apps = True
coach_recs = ["foo"]
bookmarks = ["foo"]
quiz_results = ["foo"]
data = set_data(influencer_answer, apps_to_finish, completed_apps, coach_recs, bookmarks, quiz_results)
result = WeightingService(data).call()
assert result == expected
expected = [
{
"key": "next_step",
"weight": 100,
"children": [
{
"key": "quiz",
"weight": 0,
"children": None
},
{
"key": "quiz_recommendations",
"weight": 60,
"children": None
},
{
"key": "coach_recommendations",
"weight": 80,
"children": None
},
{
"key": "bookmarks",
"weight": 70,
"children": None
},
{
"key": "next_steps_contact",
"weight": 40,
"children": None
},
{
"key": "reimbursement",
"weight": 30,
"children": None
},
{
"key": "finish_application_cta",
"weight": 90,
"children": None
},
{
"key": "completed_application",
"weight": 100,
"children": None
}
]
},
{
"key": "accordions",
"weight": 100,
"children": [
{
"key": "programs_and_applications",
"weight": 90,
"children": [
{
"key": "explore_tab",
"weight": 10,
"children": [
{
"key": "find_programs",
"weight": 0,
"children": None
},
{
"key": "view_quiz_results",
"weight": 100,
"children": None
},
{
"key": "view_programs",
"weight": 90,
"children": None
}
]
},
{
"key": "coach_recommendations_tab",
"weight": 10,
"children": [
{
"key": "accordions_contact",
"weight": 0,
"children": None
}
]
},
{
"key": "bookmarks_tab",
"weight": 10,
"children": [
{
"key": "bookmarks_cta",
"weight": 0,
"children": None
}
]
},
{
"key": "applications_tab",
"weight": 100,
"children": [
{
"key": "explore_programs_cta",
"weight": 0,
"children": None
}
]
}
]
},
{
"key": "funding",
"weight": 80,
"children": [
{
"key": "plan_options",
"weight": 100,
"children": [
{
"key": "tuition_assistance",
"weight": 100,
"children": None
},
{
"key": "full_tuition",
"weight": 90,
"children": None
}
]
},
{
"key": "tools",
"weight": 10,
"children": [
{
"key": "reimbursement",
"weight": 100,
"children": None
},
{
"key": "vouchers",
"weight": 90,
"children": None
},
{
"key": "books_and_fees",
"weight": 0,
"children": None
},
{
"key": "tools_faqs",
"weight": 70,
"children": None
}
]
}
]
},
{
"key": "resources",
"weight": 70,
"children": [
{
"key": "blog",
"weight": 100,
"children": None
},
{
"key": "explore_options",
"weight": 90,
"children": None
},
{
"key": "resources_faqs",
"weight": 80,
"children": None
},
{
"key": "refer",
"weight": 70,
"children": None
}
]
}
]
},
{
"key": "right_sidebar",
"weight": 100,
"children": [
{
"key": "your_classes",
"weight": 0,
"children": None
},
{
"key": "eligibility",
"weight": 90,
"children": None
},
{
"key": "sidebar_contact",
"weight": 80,
"children": None
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment