import unittest
from libs.reporting_finance import BudgetLine, import_csv

class budget_test(unittest.TestCase):
    def set_up(self):
        self.budget = import_csv('files/budget.csv')

    def test_finance(self):
        self.set_up()
        coef = -500
        for line in self.budget:
            if coef > 0 :
                if line.revenue == 0 :
                    line.charge += coef
                else : 
                    line.revenue += coef
            if coef < 0 :
                if line.revenue == 0 and line.charge > abs(coef) : 
                    line.charge += coef
                elif line.charge == 0 and line.revenue > abs(coef) :
                    line.revenue += coef
        