def test_badProfile(): bx = recipeReader.bsmxStages(badMashProfile(), ctrlBsmxList()) assert bx.getRecipeName() == "BadProfile" doc = bx.getDocTree() profileName = recipeReader.bsmxReadString(doc, "F_R_NAME") print profileName equipmentName = recipeReader.bsmxReadString(doc, "F_E_NAME") print equipmentName assert equipmentName == "Grain 2.5G, 5Gcooler, 4Gpot" assert bx.getEquipment() == "Grain 2.5G, 5Gcooler, 4Gpot" assert bx.getStages() == {} print myname(), "OK"
def readBMXdoc(self, doc): cloudRecipes = doc.getElementsByTagName("Cloud") for recipe in cloudRecipes: name = recipeReader.bsmxReadString(recipe, "F_R_NAME") print "....reading ", name print recipe xmlstring = recipe.toxml() if self.session.query(Recipe).filter_by(name=name).first() is None: equipment = recipeReader.bsmxReadString(recipe, "F_E_NAME") r = Recipe(name=name, equipment=equipment, bsmx=xmlstring) self.session.add(r) self.session.commit() print "==== Recipelist read ====" self.printNameList() self.fixednamelist = self.getNameList() print "========================="
def test_init_bsmxStages_string(): bx = recipeReader.bsmxStages(simpleBsmx(), ctrlBsmxList()) assert bx.getRecipeName() == "18 Rune Stone IPA 2.5G" doc = bx.getDocTree() equipmentName = recipeReader.bsmxReadString(doc, "F_E_NAME") assert equipmentName == "Grain 2.5G, 5Gcooler, 4Gpot" assert bx.getEquipment() == "Grain 2.5G, 5Gcooler, 4Gpot" assert bx.getStages() == {} print myname(), "OK"
def test_init_bsmxStages_file(): cp = os.path.dirname(__file__) print cp rp = cp + "/../../beersmith/18RuneStoneIPA.bsmx" print rp bx = recipeReader.bsmxStages(rp, ctrlBsmxList()) assert bx.getRecipeName() == "18 Rune Stone IPA 2.5G" doc = bx.getDocTree() equipmentName = recipeReader.bsmxReadString(doc, "F_E_NAME") assert equipmentName == "Grain 2.5G, 5Gcooler, 4Gpot" assert bx.getEquipment() == "Grain 2.5G, 5Gcooler, 4Gpot" #print bx.getStages() assert bx.getStages() != {} print myname(), "OK"
def test_testcold(): cp = os.path.dirname(__file__) print cp rp = cp + "/../../beersmith/testcold.bsmx" print rp bx = recipeReader.bsmxStages(rp, ctrlBsmxList()) assert bx.getRecipeName() == "testcold" doc = bx.getDocTree() equipmentName = recipeReader.bsmxReadString(doc, "F_E_NAME") print equipmentName assert equipmentName == "Grain 3G, 5Gcooler, 5Gpot" assert bx.getEquipment() == "Grain 3G, 5Gcooler, 5Gpot" #print bx.getStages() assert bx.getStages() != {} print myname(), "OK"
def test_testbatchsparge(): cp = os.path.dirname(__file__) print cp rp = cp + "/../../beersmith/SilverDollarPorter.bsmx" print rp bx = recipeReader.bsmxStages(rp, ctrlBsmxList()) print bx.getRecipeName() assert bx.getRecipeName() == "Silver Dollar Porter 2.5 gallons" doc = bx.getDocTree() equipmentName = recipeReader.bsmxReadString(doc, "F_E_NAME") print equipmentName assert equipmentName == "Pot and Cooler ( 5 Gal/19 L) - All Grain" assert bx.getEquipment() == "Pot and Cooler ( 5 Gal/19 L) - All Grain" #print bx.getStages() assert bx.getStages() != {} print myname(), "OK"