|
| 1 | +import unittest |
| 2 | +import logging |
| 3 | +import sys |
| 4 | + |
| 5 | +from tigershark.facade import f271 |
| 6 | +from tigershark.parsers import M271_5010_X279_A1 |
| 7 | + |
| 8 | + |
| 9 | +class TestParsed271(unittest.TestCase): |
| 10 | + def setUp(self): |
| 11 | + m = M271_5010_X279_A1.parsed_271 |
| 12 | + with open('tests/271-example-in-out-network.txt') as f: |
| 13 | + parsed = m.unmarshall(f.read().strip()) |
| 14 | + self.f = f271.F271_5010(parsed) |
| 15 | + |
| 16 | + def test_number_of_facades(self): |
| 17 | + self.assertEqual(len(self.f.facades), 1) |
| 18 | + |
| 19 | + def test_no_network_info(self): |
| 20 | + subscriber = self.f.facades[0].subscribers[0] |
| 21 | + benefit = subscriber.eligibility_or_benefit_information[2] |
| 22 | + cov_info = benefit.coverage_information |
| 23 | + |
| 24 | + self.assertEqual(cov_info.in_plan_network_type, None) |
| 25 | + self.assertEqual(cov_info.in_plan_network, False) |
| 26 | + self.assertEqual(cov_info.both_in_out_network, False) |
| 27 | + self.assertEqual(cov_info.out_of_plan_network, False) |
| 28 | + |
| 29 | + def test_both_network_info(self): |
| 30 | + subscriber = self.f.facades[0].subscribers[0] |
| 31 | + benefit = subscriber.eligibility_or_benefit_information[17] |
| 32 | + cov_info = benefit.coverage_information |
| 33 | + |
| 34 | + self.assertEqual(cov_info.in_plan_network_type[0], "W") |
| 35 | + self.assertEqual(cov_info.in_plan_network, False) |
| 36 | + self.assertEqual(cov_info.both_in_out_network, True) |
| 37 | + self.assertEqual(cov_info.out_of_plan_network, False) |
| 38 | + |
| 39 | + def test_out_of_network_info(self): |
| 40 | + subscriber = self.f.facades[0].subscribers[0] |
| 41 | + benefit = subscriber.eligibility_or_benefit_information[16] |
| 42 | + cov_info = benefit.coverage_information |
| 43 | + |
| 44 | + self.assertEqual(cov_info.in_plan_network_type[0], "N") |
| 45 | + self.assertEqual(cov_info.in_plan_network, False) |
| 46 | + self.assertEqual(cov_info.both_in_out_network, False) |
| 47 | + self.assertEqual(cov_info.out_of_plan_network, True) |
| 48 | + |
| 49 | + def test_in_network_info(self): |
| 50 | + subscriber = self.f.facades[0].subscribers[0] |
| 51 | + benefit = subscriber.eligibility_or_benefit_information[15] |
| 52 | + cov_info = benefit.coverage_information |
| 53 | + |
| 54 | + self.assertEqual(cov_info.in_plan_network_type[0], "Y") |
| 55 | + self.assertEqual(cov_info.in_plan_network, True) |
| 56 | + self.assertEqual(cov_info.both_in_out_network, False) |
| 57 | + self.assertEqual(cov_info.out_of_plan_network, False) |
| 58 | + |
| 59 | + |
| 60 | +if __name__ == "__main__": |
| 61 | + logging.basicConfig( |
| 62 | + stream=sys.stderr, |
| 63 | + level=logging.INFO, |
| 64 | + ) |
| 65 | + unittest.main() |
0 commit comments