def test_calc_royalties(self): dbu = DatabaseUtilities() dbu.delete_all_tables() dbu.create_some_test_econdata() pr = ProcessRoyalties() well = DataStructure() royalty = DataStructure() calc = DataStructure() monthly = DataStructure() well_lease_link = DataStructure() rtp_info = DataStructure() monthly.Product = "OIL" monthly.ProdMonth = 201501 monthly.ProdVol = 100 monthly.ProdHours = 744 monthly.SalesPrice = 210.0 royalty.RoyaltyScheme = "SKProvCrownVar" royalty.OverrideRoyaltyClassification = None royalty.ValuationMethod = "ActSales" royalty.CrownModifier = None royalty.MinRoyaltyRate = None royalty.CrownMultiplier = 1.0 royalty.MinRoyaltyDollar = None royalty.TransDeducted = None well.CommencementDate = date(2015, 1, 22) well.RoyaltyClassification = "Old Oil" well.Classification = "Other" well.SRC = 0.0 well_lease_link.PEFNInterest = 1.0 rtp_info.Percent = 100.0 calc.SuppRoyaltyValue = 0.0 calc.GorrRoyaltyValue = 0.0 calc.TransGorrValue = 0.0 pr.calc_royalties(well, royalty, calc, monthly, well_lease_link, rtp_info) royalty.RoyaltyScheme = "IOGR1995" pr.calc_royalties(well, royalty, calc, monthly, well_lease_link, rtp_info) royalty.RoyaltyScheme = "IOGR1995,GORR" royalty.Gorr = "fixed,0,.02" pr.calc_royalties(well, royalty, calc, monthly, well_lease_link, rtp_info)
def test_process_monthly(self): db = config.get_database() dbu = DatabaseUtilities() dbu.delete_all_tables() dbu.create_some_test_well_royalty_masters() dbu.create_some_test_lease_royalty_masters() dbu.create_some_test_leases() dbu.create_some_test_well_lease_link() dbu.create_some_test_monthly() dbu.create_some_test_econdata() dbu.create_some_test_rtp_info() dbu.create_calc() pr = ProcessRoyalties() pr.process_one(4, 201501, "OIL") # Check to see if the oper record exists self.assertEqual(2, db.count("calc")) pr.process_all() self.assertEqual(3, db.count("calc"))