def test_fix_date_cancelled(self): status = 'Cancelled' party_status_map = {'Cancelled': 'canceled'} actual = MB.fix_date(date='2020-01-01', party_status_map=party_status_map, status=status) expected = datetime.now().strftime('%m/%d/%Y') self.assertEqual(actual, expected)
def test_is_deceased(self): for (k, v) in { 'Current': False, 'Cancelled': False, 'Deceased': True, 'Expired': False, 'Grace': False, 'New': False, }.items(): actual = MB.is_deceased(status=k) expected = v self.assertEqual(actual, expected)
def test_is_deceased(self): for (k, v) in { 'Current':False, 'Cancelled':False, 'Deceased':True, 'Expired':False, 'Grace':False, 'New':False, }.items(): actual = MB.is_deceased(status=k) expected = v self.assertEqual(actual, expected)
def test_get_party(self): party_map = { 'Current': 'G', 'Cancelled': None, 'Deceased': None, 'Expired': None, 'Grace': 'G', 'New': 'G', } for (status, v) in party_map.items(): actual = MB.get_party(party_map, status) expected = v self.assertEqual(actual, expected)
def test_get_support_level(self): support_level_map = { 'Current': 1, 'Cancelled': 4, 'Deceased': None, 'Expired': 2, 'Grace': 1, 'New': 1, } for (k, v) in support_level_map.items(): actual = MB.get_support_level(support_level_map, status=k) expected = v self.assertEqual(actual, expected)
def test_get_party_member(self): party_member_map = { 'Current':True, 'Cancelled':False, 'Deceased':False, 'Expired':False, 'Grace':True, 'New':True, } for (k, v) in party_member_map.items(): actual = MB.get_party_member(party_member_map, status=k) expected = v self.assertEqual(actual, expected)
def test_get_support_level(self): support_level_map = { 'Current':1, 'Cancelled':4, 'Deceased':None, 'Expired':2, 'Grace':1, 'New':1, } for (k, v) in support_level_map.items(): actual = MB.get_support_level(support_level_map, status=k) expected = v self.assertEqual(actual, expected)
def test_get_party_member(self): party_member_map = { 'Current': True, 'Cancelled': False, 'Deceased': False, 'Expired': False, 'Grace': True, 'New': True, } for (k, v) in party_member_map.items(): actual = MB.get_party_member(party_member_map, status=k) expected = v self.assertEqual(actual, expected)
def test_get_status(self): status_map = { 'Current': 'active', 'Cancelled': 'canceled', 'Deceased': 'deceased', 'Expired': 'expired', 'Grace': 'grace period', 'New': 'active', } for (status, v) in status_map.items(): actual = MB.get_status(status_map, status=status) expected = v self.assertEqual(actual, expected)
def test_get_status_end_date_in_past(self): status_map = { 'Current':'active', 'Cancelled':'canceled', 'Deceased':'deceased', 'Expired':'expired', 'Grace':'grace period', 'New':'active', 'Pending':'grace period', } end_date = '2016-01-01' for (status, v) in status_map.items(): actual = MB.get_status(status_map, status=status, end_date=end_date) expected = 'grace period' if v == 'active' else v self.assertEqual(actual, expected)
def test_get_status(self): status_map = { 'Current':'active', 'Cancelled':'canceled', 'Deceased':'deceased', 'Expired':'expired', 'Grace':'grace period', 'New':'active', 'Pending':'grace period', } end_date = datetime.now().strftime('%Y-%m-%d') for (status, v) in status_map.items(): actual = MB.get_status(status_map, status=status, end_date=end_date) expected = v self.assertEqual(actual, expected)
def test_get_status_end_date_in_past(self): status_map = { 'Current': 'active', 'Cancelled': 'canceled', 'Deceased': 'deceased', 'Expired': 'expired', 'Grace': 'grace period', 'New': 'active', 'Pending': 'grace period', } end_date = '2016-01-01' for (status, v) in status_map.items(): actual = MB.get_status(status_map, status=status, end_date=end_date) expected = 'grace period' if v == 'active' else v self.assertEqual(actual, expected)
def test_get_status(self): status_map = { 'Current': 'active', 'Cancelled': 'canceled', 'Deceased': 'deceased', 'Expired': 'expired', 'Grace': 'grace period', 'New': 'active', 'Pending': 'grace period', } end_date = datetime.now().strftime('%Y-%m-%d') for (status, v) in status_map.items(): actual = MB.get_status(status_map, status=status, end_date=end_date) expected = v self.assertEqual(actual, expected)
def test_fix_date_cancelled(self): status = 'Cancelled' party_status_map = {'Cancelled':'canceled'} actual = MB.fix_date(date='2020-01-01', party_status_map=party_status_map, status=status) expected = datetime.now().strftime('%m/%d/%Y') self.assertEqual(actual, expected)
def test_get_party_green(self): actual = MB.get_party_green() expected = 'G' self.assertEqual(actual, expected)
def test_get_party(self): party_map = {'Current':'G', 'Cancelled':None, 'Deceased':None, 'Expired':None, 'Grace':'G', 'New':'G', } for (status, v) in party_map.items(): actual = MB.get_party(party_map, status) expected = v self.assertEqual(actual, expected)
def test_fix_date_empty(self): actual = MB.fix_date(date='') expected = '' self.assertEqual(actual, expected)
def test_fix_date(self): actual = MB.fix_date(date='1956-12-31') expected = '12/31/1956' self.assertEqual(actual, expected)