Skip to content

Commit

Permalink
tests removed
Browse files Browse the repository at this point in the history
  • Loading branch information
susu105 committed Apr 25, 2022
1 parent 9745130 commit 57254b9
Showing 1 changed file with 0 additions and 107 deletions.
107 changes: 0 additions & 107 deletions som_generationkwh/tests/investment_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1692,113 +1692,6 @@ def test__pending_amortization_summary__allInvestments(self):
self.assertEqual((4, 120),
self.Investment.pending_amortization_summary(cursor, uid, '2022-11-20'))

def test__send_emails_to_investors_with_savings_in_year__whenNoGenkwhEmission(self):
"""
Check send_emails_to_investors_with_savings_in_year when no emissions for Generationkwh
:return:
"""
with Transaction().start(self.database) as txn:
cursor = txn.cursor
uid = txn.user

all_emissions = self.Emission.search(cursor, uid, [])
self.Emission.write(cursor, uid, all_emissions, dict(type='apo'))

# year 2020 in order to take effects over genkwh_0002 generationkwh investment
ret_value = self.Soci.send_emails_to_investors_with_savings_in_year(cursor, uid, year=2020)
self.assertEqual(ret_value, 0)

def test__send_emails_to_investors_with_savings_in_year__when_noFirstEffectiveDate(self):
"""
Check send_emails_to_investors_with_savings_in_year no active investments,
not already paid (first_effective_date is False)
:return:
"""
with Transaction().start(self.database) as txn:
cursor = txn.cursor
uid = txn.user

all_gen_investments = self.Investment.search(cursor, uid, [('emission_id.type', '=', 'genkwh')])
self.Investment.write(cursor, uid, all_gen_investments, dict(first_effective_date=False))

ret_value = self.Soci.send_emails_to_investors_with_savings_in_year(cursor, uid, year=2020)
self.assertEqual(ret_value, 0)

def test__send_emails_to_investors_with_savings_in_year__when_invalidFirstEffectiveDate(self):
"""
Check send_emails_to_investors_with_savings_in_year when no active investments,
investments out of active period (first_effective_date over fiscal year used)
:return:
"""
with Transaction().start(self.database) as txn:
cursor = txn.cursor
uid = txn.user

all_gen_investments = self.Investment.search(cursor, uid, [('emission_id.type', '=', 'genkwh')])
self.Investment.write(cursor, uid, all_gen_investments, dict(first_effective_date='01-01-2021'))

ret_value = self.Soci.send_emails_to_investors_with_savings_in_year(cursor, uid, year=2020)
self.assertEqual(ret_value, 0)

def test__send_emails_to_investors_with_savings_in_year__when_oneMember(self):
"""
Check send_emails_to_investors_with_savings_in_year when one member one emission
:return:
"""
with Transaction().start(self.database) as txn:
cursor = txn.cursor
uid = txn.user

investments = self.Investment.search(cursor, uid, [('emission_id.type', '=', 'genkwh'),
('first_effective_date', '>=', '2020-01-01'),
('first_effective_date', '<=', '2020-12-31')])
one_valid_investment = investments[0]
investments.remove(one_valid_investment)
self.Investment.write(cursor, uid, investments, dict(first_effective_date=False))

ret_value = self.Soci.send_emails_to_investors_with_savings_in_year(cursor, uid, year=2020)
self.assertEqual(ret_value, 1)

def test__send_emails_to_investors_with_savings_in_year__when_manyInvestmets_sameMember(self):
"""
Check send_emails_to_investors_with_savings_in_year when many investments same member
:return:
"""
with Transaction().start(self.database) as txn:
cursor = txn.cursor
uid = txn.user

investments = self.Investment.search(cursor, uid, [('emission_id.type', '=', 'genkwh'),
('first_effective_date', '>=', '2020-01-01'),
('first_effective_date', '<=', '2020-12-31')])

member_id = self.Investment.read(cursor, uid, investments[0], ['member_id'])['member_id'][0]
for investment_id in investments:
self.Investment.write(cursor, uid, investments, dict(member_id=member_id))

ret_value = self.Soci.send_emails_to_investors_with_savings_in_year(cursor, uid, year=2020)

self.assertTrue(len(investments) > 1)
self.assertEqual(ret_value, 1)


def test__send_emails_to_investors_with_savings_in_year__when_manyMembers(self):
"""
Check send_emails_to_investors_with_savings_in_year when many members, one investment each
:return:
"""
with Transaction().start(self.database) as txn:
cursor = txn.cursor
uid = txn.user

investments = self.Investment.search(cursor, uid, [('emission_id.type', '=', 'genkwh'),
('first_effective_date', '>=', '2020-01-01'),
('first_effective_date', '<=', '2020-12-31')])

ret_value = self.Soci.send_emails_to_investors_with_savings_in_year(cursor, uid, year=2020)
self.assertEqual(ret_value, len(investments))


def test__get_stats_investment_generation__when_last_effective_date(self):
"""
Check get_stats_investment_generation when some investements with last_effective_date
Expand Down

0 comments on commit 57254b9

Please sign in to comment.