def test_build_pattern_list_from_yarn(self): """ With input BasketYarn, is list of SearchResultPatterns returned? """ pattern_list = build_pattern_list_from_yarn(basket_yarn_id=2) self.assertIsInstance(pattern_list, list) first_pattern = pattern_list[0] self.assertIsInstance(first_pattern, Pattern)
def test_build_pattern_list_from_yarn(self): """ With input BasketYarn, is list of SearchResultPatterns returned? """ pattern_list = build_pattern_list_from_yarn(basket_yarn_id=2) self.assertIsInstance(pattern_list, list) first_pattern = pattern_list[0] self.assertIsInstance(first_pattern, Pattern)
def yarn_driven_search(basket_yarn_id): """Shows patterns given a basket yarn. Patterns are linked to Yarns through Projects. This function will return Pattern object for which there are Projects which have both this Pattern and Yarn linked.""" user = verify_login(session) if not user: return redirect("/") basket_yarn = BasketYarn.query.get(basket_yarn_id) list_of_patterns = build_pattern_list_from_yarn(basket_yarn_id) return render_template("patterns_for_basket_yarn.html", basket_yarn=basket_yarn, patterns=list_of_patterns)