From 0d3bc70b53f6bd6c690a0a6452576fcc115a2be6 Mon Sep 17 00:00:00 2001 From: grindsa Date: Sat, 4 Jan 2025 07:32:58 +0100 Subject: [PATCH] [tst] unittests --- test/test_api.py | 112 +++++++++++++++++++++++++---------------------- 1 file changed, 59 insertions(+), 53 deletions(-) diff --git a/test/test_api.py b/test/test_api.py index c9ce272..0c95ba1 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -1509,14 +1509,20 @@ def test_129__objectname_lookup(self): self.dkb.account_dic = {0: {'id': 'cardId', 'foo': 'bar', 'account': 'account'}} self.assertEqual('subject foo', self.dkb._objectname_lookup(document)) + def test_130__objectname_lookup(self): + """ test _objectname_lookup() """ + document = {'attributes': {'metadata': {'cardId': 'cardId1'}, 'fileName': 'boo_foo_bar'}} + self.dkb.account_dic = {0: {'id': 'cardId', 'foo': 'bar', 'account': 'account'}} + self.assertEqual('boo_foo_bar foo', self.dkb._objectname_lookup(document)) + @patch('dkb_robo.legacy.Wrapper.get_exemption_order') - def test_130_get_exemption_order(self, mock_exo): + def test_131_get_exemption_order(self, mock_exo): """ test get_exemption_order() """ mock_exo.return_value = 'mock_exo' self.assertEqual('mock_exo', self.dkb.get_exemption_order()) @patch('dkb_robo.api.Wrapper._filter_postbox') - def test_131_scan_postbox(self, mock_filter): + def test_132_scan_postbox(self, mock_filter): """ test scan_postbox() """ self.dkb.client = Mock() self.dkb.client.get.return_value.side_effects = [400, 400] @@ -1525,7 +1531,7 @@ def test_131_scan_postbox(self, mock_filter): self.assertFalse(mock_filter.called) @patch('dkb_robo.api.Wrapper._filter_postbox') - def test_132_scan_postbox(self, mock_filter): + def test_133_scan_postbox(self, mock_filter): """ test scan_postbox() """ self.dkb.client = Mock() self.dkb.client.get.return_value.side_effects = [400, 200] @@ -1534,7 +1540,7 @@ def test_132_scan_postbox(self, mock_filter): self.assertFalse(mock_filter.called) @patch('dkb_robo.api.Wrapper._filter_postbox') - def test_133_scan_postbox(self, mock_filter): + def test_134_scan_postbox(self, mock_filter): """ test scan_postbox() """ self.dkb.client = Mock() self.dkb.client.get.return_value.side_effects = [200, 400] @@ -1543,7 +1549,7 @@ def test_133_scan_postbox(self, mock_filter): self.assertFalse(mock_filter.called) @patch('dkb_robo.api.Wrapper._filter_postbox') - def test_134_scan_postbox(self, mock_filter): + def test_135_scan_postbox(self, mock_filter): """ test scan_postbox() """ self.dkb.client = Mock() self.dkb.client.get.return_value.status_code = 200 @@ -1556,7 +1562,7 @@ def test_134_scan_postbox(self, mock_filter): @patch('dkb_robo.api.Wrapper._download_document') @patch('dkb_robo.api.Wrapper._get_document_type') @patch('dkb_robo.api.Wrapper._objectname_lookup') - def test_135__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): + def test_136__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): """ _filter_postbox() """ pb_dic = {'data': [{'id': 'id1', 'attributes': {'fileName': 'filename1', 'contentType': 'contentType1', 'metadata':{'statementDate': 'statementDate1'}}}, {'id': 'id2', 'attributes': {'fileName': 'filename2', 'contentType': 'contentType2', 'metadata':{'statementDate': 'statementDate2'}}}]} msg_dic = {'data': [{'id': 'id1', 'attributes': {'documentType': 'documentType1', 'read': False, 'archived': False}}, {'id': 'id2', 'attributes': {'documentType': 'documentType2', 'read': False, 'archived': False}}]} @@ -1573,7 +1579,7 @@ def test_135__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_s @patch('dkb_robo.api.Wrapper._download_document') @patch('dkb_robo.api.Wrapper._get_document_type') @patch('dkb_robo.api.Wrapper._objectname_lookup') - def test_136__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): + def test_137__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): """ _filter_postbox() """ pb_dic = {'data': [{'id': 'id1', 'attributes': {'fileName': 'filename1', 'contentType': 'contentType1', 'metadata':{'statementDate': 'statementDate1'}}}, {'id': 'id2', 'attributes': {'fileName': 'filename2', 'contentType': 'contentType2', 'metadata':{'statementDate': 'statementDate2'}}}]} msg_dic = {'data': [{'id': 'id1', 'attributes': {'documentType': 'documentType1', 'read': False, 'archived': False}}, {'id': 'id2', 'attributes': {'documentType': 'documentType2', 'read': True, 'archived': False}}]} @@ -1590,7 +1596,7 @@ def test_136__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_s @patch('dkb_robo.api.Wrapper._download_document') @patch('dkb_robo.api.Wrapper._get_document_type') @patch('dkb_robo.api.Wrapper._objectname_lookup') - def test_137__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): + def test_138__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): """ _filter_postbox() """ pb_dic = {'data': [{'id': 'id1', 'attributes': {'fileName': 'filename1', 'contentType': 'contentType1', 'metadata':{'statementDate': 'statementDate1'}}}, {'id': 'id2', 'attributes': {'fileName': 'filename2', 'contentType': 'contentType2', 'metadata':{'statementDate': 'statementDate2'}}}]} msg_dic = {'data': [{'id': 'id1', 'attributes': {'documentType': 'documentType1', 'read': False, 'archived': False}}, {'id': 'id2', 'attributes': {'documentType': 'documentType2', 'read': True, 'archived': False}}]} @@ -1607,7 +1613,7 @@ def test_137__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_s @patch('dkb_robo.api.Wrapper._download_document') @patch('dkb_robo.api.Wrapper._get_document_type') @patch('dkb_robo.api.Wrapper._objectname_lookup') - def test_138__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): + def test_139__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): """ _filter_postbox() """ pb_dic = {'data': [{'id': 'id1', 'attributes': {'fileName': 'filename1', 'contentType': 'contentType1', 'metadata':{'statementDate': 'statementDate1'}}}, {'id': 'id2', 'attributes': {'fileName': 'filename2', 'contentType': 'contentType2', 'metadata':{'statementDate': 'statementDate2'}}}]} msg_dic = {'data': [{'id': 'id1', 'attributes': {'documentType': 'documentType1', 'read': False, 'archived': False}}, {'id': 'id2', 'attributes': {'documentType': 'documentType2', 'read': True, 'archived': False}}]} @@ -1624,7 +1630,7 @@ def test_138__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_s @patch('dkb_robo.api.Wrapper._download_document') @patch('dkb_robo.api.Wrapper._get_document_type') @patch('dkb_robo.api.Wrapper._objectname_lookup') - def test_139__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): + def test_140__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): """ _filter_postbox() """ pb_dic = {'data': [{'id': 'id1', 'attributes': {'fileName': 'filename1', 'contentType': 'contentType1', 'metadata':{'statementDate': 'statementDate1'}}}, {'id': 'id2', 'attributes': {'fileName': 'filename2', 'contentType': 'contentType2', 'metadata':{'statementDate': 'statementDate2'}}}]} msg_dic = {'data': [{'id': 'id1', 'attributes': {'documentType': 'documentType1', 'read': False, 'archived': False}}, {'id': 'id2', 'attributes': {'documentType': 'documentType2', 'read1': True, 'archived': False}}]} @@ -1643,7 +1649,7 @@ def test_139__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_s @patch('dkb_robo.api.Wrapper._download_document') @patch('dkb_robo.api.Wrapper._get_document_type') @patch('dkb_robo.api.Wrapper._objectname_lookup') - def test_140__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): + def test_141__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): """ _filter_postbox() """ pb_dic = {'data': [{'id': 'id1', 'attributes': {'fileName': 'filename1', 'contentType': 'contentType1', 'metadata':{'statementDate': 'statementDate1'}}}, {'id': 'id2', 'attributes': {'fileName': 'filename2', 'contentType': 'contentType2', 'metadata':{'statementDate': 'statementDate2'}}}]} msg_dic = {'data': [{'id': 'id1', 'attributes': {'documentType': 'documentType1', 'read': False, 'archived': False}}, {'id': 'id2', 'attributes': {'documentType': 'documentType2', 'read': True, 'archived': False}}]} @@ -1660,7 +1666,7 @@ def test_140__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_s @patch('dkb_robo.api.Wrapper._download_document') @patch('dkb_robo.api.Wrapper._get_document_type') @patch('dkb_robo.api.Wrapper._objectname_lookup') - def test_141__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): + def test_142__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_sleep): """ _filter_postbox() """ pb_dic = {'data': [{'id': 'id1', 'attributes': {'fileName': 'filename1', 'contentType': 'contentType1', 'metadata':{'statementDate': 'statementDate1'}}}, {'id': 'id2', 'attributes': {'fileName': 'filename1', 'contentType': 'contentType2', 'metadata':{'statementDate': 'statementDate2'}}}]} msg_dic = {'data': [{'id': 'id1', 'attributes': {'documentType': 'documentType1', 'read': False, 'archived': False}}, {'id': 'id2', 'attributes': {'documentType': 'documentType2', 'read': True, 'archived': False}}]} @@ -1677,7 +1683,7 @@ def test_141__filter_postbox(self, mock_lookup, mock_type, mock_download, mock_s @patch('time.sleep') @patch('os.makedirs') @patch('os.path.exists') - def test_142__download_document(self, mock_exists, mock_makedir, mock_sleep, mock_open): + def test_143__download_document(self, mock_exists, mock_makedir, mock_sleep, mock_open): """ _get_document() """ mock_exists.return_value = False self.dkb.client = Mock() @@ -1694,7 +1700,7 @@ def test_142__download_document(self, mock_exists, mock_makedir, mock_sleep, moc @patch('time.sleep') @patch('os.makedirs') @patch('os.path.exists') - def test_143__download_document(self, mock_exists, mock_makedir, mock_sleep, mock_open): + def test_144__download_document(self, mock_exists, mock_makedir, mock_sleep, mock_open): """ _get_document() """ mock_exists.return_value = False self.dkb.client = Mock() @@ -1713,7 +1719,7 @@ def test_143__download_document(self, mock_exists, mock_makedir, mock_sleep, moc @patch('time.sleep') @patch('os.makedirs') @patch('os.path.exists') - def test_144__download_document(self, mock_exists, mock_makedir, mock_sleep, mock_open): + def test_145__download_document(self, mock_exists, mock_makedir, mock_sleep, mock_open): """ _get_document() """ mock_exists.return_value = False self.dkb.client = Mock() @@ -1728,7 +1734,7 @@ def test_144__download_document(self, mock_exists, mock_makedir, mock_sleep, moc self.assertTrue(self.dkb.client.patch.called) self.assertTrue(mock_open.called) - def test_145_sort_mfa_devices(self): + def test_146_sort_mfa_devices(self): """ test sort_mfa_devices() """ mfa_dic = { 'data': [ @@ -1747,7 +1753,7 @@ def test_145_sort_mfa_devices(self): self.assertEqual(expected_result, self.dkb._sort_mfa_devices(mfa_dic)) - def test_146_sort_mfa_devices(self): + def test_147_sort_mfa_devices(self): """ test sort_mfa_devices() """ mfa_dic = { 'data': [ @@ -1766,7 +1772,7 @@ def test_146_sort_mfa_devices(self): self.assertEqual(expected_result, self.dkb._sort_mfa_devices(mfa_dic)) - def test_147_sort_mfa_devices(self): + def test_148_sort_mfa_devices(self): """ test sort_mfa_devices() """ mfa_dic = { 'data': [ @@ -1784,22 +1790,22 @@ def test_147_sort_mfa_devices(self): } self.assertEqual(expected_result, self.dkb._sort_mfa_devices(mfa_dic)) - def test_148__docdate_lookup(self): + def test_149__docdate_lookup(self): """ test _docdate_lookup() """ input_dic = {'attributes': {'metadata': {'statementDate': 'statementDate'}}} self.assertEqual('statementDate', self.dkb._docdate_lookup(input_dic)) - def test_149__docdate_lookup(self): + def test_150__docdate_lookup(self): """ test _docdate_lookup() """ input_dic = {'attributes': {'metadata': {'creationDate': 'creationDate'}}} self.assertEqual('creationDate', self.dkb._docdate_lookup(input_dic)) - def test_150__docdate_lookup(self): + def test_151__docdate_lookup(self): """ test _docdate_lookup() """ input_dic = {'attributes': {'metadata': {'fooDate': 'creationDate'}}} self.assertEqual('unknown', self.dkb._docdate_lookup(input_dic)) - def test_151_get_transaction_list(self): + def test_152_get_transaction_list(self): """ test _get_transaction_list()""" self.dkb.client = Mock() self.dkb.client.get.return_value.status_code = 400 @@ -1808,59 +1814,59 @@ def test_151_get_transaction_list(self): self.assertEqual({'data': [], 'included': []}, self.dkb._get_transaction_list('transaction_url')) self.assertIn('ERROR:dkb_robo:api.Wrapper._get_transactions(): RC is not 200 but 400', lcm.output) - def test_152_get_transaction_list(self): + def test_153_get_transaction_list(self): """ test _get_transaction_list()""" self.dkb.client = Mock() self.dkb.client.get.return_value.status_code = 200 self.dkb.client.get.return_value.json.return_value = {'foo': 'bar'} self.assertEqual({'data': [], 'included': []}, self.dkb._get_transaction_list('transaction_url')) - def test_153_get_transaction_list(self): + def test_154_get_transaction_list(self): """ test _get_transaction_list()""" self.dkb.client = Mock() self.dkb.client.get.return_value.status_code = 200 self.dkb.client.get.return_value.json.return_value = {'data': [{'foo1': 'bar1'}, {'foo2': 'bar2'}]} self.assertEqual({'data': [{'foo1': 'bar1'}, {'foo2': 'bar2'}], 'included': []}, self.dkb._get_transaction_list('transaction_url')) - def test_154_get_transaction_list(self): + def test_155_get_transaction_list(self): """ test _get_transaction_list()""" self.dkb.client = Mock() self.dkb.client.get.return_value.status_code = 200 self.dkb.client.get.return_value.json.side_effect = [{'data': [{'foo1': 'bar1'}, {'foo2': 'bar2'}], 'links': {'next': 'next_url'}}, {'data': [{'foo3': 'bar3'}, {'foo4': 'bar4'}], 'links': {'foo': 'bar'}}] self.assertEqual({'data': [{'foo1': 'bar1'}, {'foo2': 'bar2'}, {'foo3': 'bar3'}, {'foo4': 'bar4'}], 'included': []}, self.dkb._get_transaction_list('transaction_url')) - def test_155_get_transaction_list(self): + def test_156_get_transaction_list(self): """ test _get_transaction_list()""" self.dkb.client = Mock() self.dkb.client.get.return_value.status_code = 200 self.dkb.client.get.return_value.json.side_effect = [{'data': [{'foo1': 'bar1'}, {'foo2': 'bar2'}], 'links': {'next': 'next_url'}, 'included': ['1']}, {'data': [{'foo3': 'bar3'}, {'foo4': 'bar4'}], 'links': {'foo': 'bar'}, 'included': ['2']}] self.assertEqual({'data': [{'foo1': 'bar1'}, {'foo2': 'bar2'}, {'foo3': 'bar3'}, {'foo4': 'bar4'}], 'included': ['1', '2']}, self.dkb._get_transaction_list('transaction_url')) - def test_156_init(self): + def test_157_init(self): """ test init() """ self.dkb.__init__() self.assertEqual('seal_one', self.dkb.mfa_method) - def test_157_init(self): + def test_158_init(self): """ test init() """ with self.assertLogs('dkb_robo', level='INFO') as lcm: self.dkb.__init__(logger=self.logger, chip_tan=True) self.assertIn('INFO:dkb_robo:Using to chip_tan to login', lcm.output) self.assertEqual('chip_tan_manual', self.dkb.mfa_method) - def test_158_init(self): + def test_159_init(self): """ test init() """ self.dkb.__init__(logger=self.logger, chip_tan=False) self.assertEqual('seal_one', self.dkb.mfa_method) - def test_159_init(self): + def test_160_init(self): """ test init() """ with self.assertLogs('dkb_robo', level='INFO') as lcm: self.dkb.__init__(logger=self.logger, chip_tan='qr') self.assertIn('INFO:dkb_robo:Using to chip_tan to login', lcm.output) self.assertEqual('chip_tan_qr', self.dkb.mfa_method) - def test_160_init(self): + def test_161_init(self): """ test init() """ with self.assertLogs('dkb_robo', level='INFO') as lcm: self.dkb.__init__(logger=self.logger, chip_tan='chip_tan_qr') @@ -1870,7 +1876,7 @@ def test_160_init(self): @patch('dkb_robo.api.Wrapper._complete_ctm_2fa') @patch('dkb_robo.api.Wrapper._complete_app_2fa') @patch('dkb_robo.api.Wrapper._get_challenge_id') - def test_161_complete_2fa(self, mock_cid, mock_app, mock_ctm): + def test_162_complete_2fa(self, mock_cid, mock_app, mock_ctm): """ test _complete_2fa() """ mock_cid.return_value = 'cid' mock_app.return_value = 'app' @@ -1884,7 +1890,7 @@ def test_161_complete_2fa(self, mock_cid, mock_app, mock_ctm): @patch('dkb_robo.api.Wrapper._complete_ctm_2fa') @patch('dkb_robo.api.Wrapper._complete_app_2fa') @patch('dkb_robo.api.Wrapper._get_challenge_id') - def test_162_complete_2fa(self, mock_cid, mock_app, mock_ctm): + def test_163_complete_2fa(self, mock_cid, mock_app, mock_ctm): """ test _complete_2fa() """ mock_cid.return_value = 'cid' mock_app.return_value = 'app' @@ -1898,7 +1904,7 @@ def test_162_complete_2fa(self, mock_cid, mock_app, mock_ctm): @patch('dkb_robo.api.Wrapper._complete_ctm_2fa') @patch('dkb_robo.api.Wrapper._complete_app_2fa') @patch('dkb_robo.api.Wrapper._get_challenge_id') - def test_163_complete_2fa(self, mock_cid, mock_app, mock_ctm): + def test_164_complete_2fa(self, mock_cid, mock_app, mock_ctm): """ test _complete_2fa() """ mock_cid.return_value = 'cid' mock_app.return_value = 'app' @@ -1912,7 +1918,7 @@ def test_163_complete_2fa(self, mock_cid, mock_app, mock_ctm): self.assertFalse(mock_ctm.called) @patch('requests.session') - def test_164_get_challenge_id(self, mock_session): + def test_165_get_challenge_id(self, mock_session): """ test _get_challenge_id() """ mfa_dic = {} with self.assertRaises(Exception) as err: @@ -1920,7 +1926,7 @@ def test_164_get_challenge_id(self, mock_session): self.assertEqual('Login failed: challenge response format is other than expected: {}', str(err.exception)) @patch('requests.session') - def test_165_get_challenge_id(self, mock_session): + def test_166_get_challenge_id(self, mock_session): """ test _get_challenge_id() """ mfa_dic = {'data': {'id': 'id', 'type': 'type'}} with self.assertRaises(Exception) as err: @@ -1928,13 +1934,13 @@ def test_165_get_challenge_id(self, mock_session): self.assertEqual("Login failed:: wrong challenge type: {'data': {'id': 'id', 'type': 'type'}}", str(err.exception)) @patch('requests.session') - def test_166_get_challenge_id(self, mock_session): + def test_167_get_challenge_id(self, mock_session): """ test _get_challenge_id() """ mfa_dic = {'data': {'id': 'id', 'type': 'mfa-challenge'}} self.assertEqual('id', self.dkb._get_challenge_id(mfa_dic)) @patch('requests.session') - def test_167_get_mfa_challenge_dic(self, mock_session): + def test_168_get_mfa_challenge_dic(self, mock_session): """ test _get_mfa_challenge_id() """ mfa_dic = {} with self.assertLogs('dkb_robo', level='INFO') as lcm: @@ -1942,7 +1948,7 @@ def test_167_get_mfa_challenge_dic(self, mock_session): self.assertIn('ERROR:dkb_robo:api.Wrapper._get_mfa_challenge_dic(): mfa_dic has an unexpected data structure', lcm.output) @patch('requests.session') - def test_168_get_mfa_challenge_dic(self, mock_session): + def test_169_get_mfa_challenge_dic(self, mock_session): """ test _get_mfa_challenge_id() """ self.dkb.client = Mock() self.dkb.client.headers = {} @@ -1955,7 +1961,7 @@ def test_168_get_mfa_challenge_dic(self, mock_session): self.assertEqual(({'data': {'id': 'id', 'type': 'mfa-challenge'}}, 'deviceName'), self.dkb._get_mfa_challenge_dic(mfa_dic, 1)) @patch('requests.session') - def test_169_get_mfa_challenge_dic(self, mock_session): + def test_170_get_mfa_challenge_dic(self, mock_session): """ test _get_mfa_challenge_id() """ self.dkb.client = Mock() self.dkb.client.headers = {} @@ -1970,7 +1976,7 @@ def test_169_get_mfa_challenge_dic(self, mock_session): self.assertEqual('Login failed: post request to get the mfa challenges failed. RC: 400', str(err.exception)) @patch('requests.session') - def test_170_get_mfa_challenge_dic(self, mock_session): + def test_171_get_mfa_challenge_dic(self, mock_session): """ test _get_mfa_challenge_id() """ self.dkb.client = Mock() self.dkb.client.headers = {} @@ -1987,7 +1993,7 @@ def test_170_get_mfa_challenge_dic(self, mock_session): @patch('time.sleep', return_value=None) @patch('dkb_robo.api.Wrapper._check_processing_status') @patch('dkb_robo.api.Wrapper._print_app_2fa_confirmation') - def test_171__complete_app_2fa(self, mock_confirm, mock_status, _mock_sleep): + def test_172__complete_app_2fa(self, mock_confirm, mock_status, _mock_sleep): """ test _complete_2fa() """ self.dkb.client = Mock() self.dkb.client.headers = {} @@ -2002,7 +2008,7 @@ def test_171__complete_app_2fa(self, mock_confirm, mock_status, _mock_sleep): @patch('time.sleep', return_value=None) @patch('dkb_robo.api.Wrapper._check_processing_status') @patch('dkb_robo.api.Wrapper._print_app_2fa_confirmation') - def test_172__complete_app_2fa(self, mock_confirm, mock_status, _mock_sleep): + def test_173__complete_app_2fa(self, mock_confirm, mock_status, _mock_sleep): """ test _complete_2fa() """ self.dkb.client = Mock() self.dkb.client.headers = {} @@ -2015,7 +2021,7 @@ def test_172__complete_app_2fa(self, mock_confirm, mock_status, _mock_sleep): self.assertTrue(mock_confirm.called) @patch('dkb_robo.api.Wrapper._print_ctan_instructions') - def test_173_complete_ctm_2fa(self, mock_ctan): + def test_174_complete_ctm_2fa(self, mock_ctan): """ test _complete_ctm_2fa()""" mock_ctan.return_value = 'ctan' self.dkb.client = Mock() @@ -2027,7 +2033,7 @@ def test_173_complete_ctm_2fa(self, mock_ctan): self.assertTrue(mock_ctan.called) @patch('dkb_robo.api.Wrapper._print_ctan_instructions') - def test_174_complete_ctm_2fa(self, mock_ctan): + def test_175_complete_ctm_2fa(self, mock_ctan): """ test _complete_ctm_2fa()""" mock_ctan.return_value = 'ctan' self.dkb.client = Mock() @@ -2039,7 +2045,7 @@ def test_174_complete_ctm_2fa(self, mock_ctan): self.assertTrue(mock_ctan.called) @patch('dkb_robo.api.Wrapper._print_ctan_instructions') - def test_175_complete_ctm_2fa(self, mock_ctan): + def test_176_complete_ctm_2fa(self, mock_ctan): """ test _complete_ctm_2fa()""" mock_ctan.return_value = 'ctan' self.dkb.client = Mock() @@ -2054,7 +2060,7 @@ def test_175_complete_ctm_2fa(self, mock_ctan): self.assertTrue(mock_ctan.called) @patch('dkb_robo.api.Wrapper._show_image') - def test_176__print_ctan_instructions(self, mock_show): + def test_177__print_ctan_instructions(self, mock_show): """ test _print_ctan_instructions()""" challenge_dic = {} self.assertFalse(self.dkb._print_ctan_instructions(challenge_dic)) @@ -2063,7 +2069,7 @@ def test_176__print_ctan_instructions(self, mock_show): @unittest.mock.patch('sys.stdout', new_callable=io.StringIO) @patch('dkb_robo.api.Wrapper._show_image') @patch('builtins.input') - def test_177__print_ctan_instructions(self, mock_input, mock_show, mock_stdout): + def test_178__print_ctan_instructions(self, mock_input, mock_show, mock_stdout): """ test _print_ctan_instructions()""" challenge_dic = {'data': {'attributes': {'chipTan': {'headline': 'headline', 'instructions': ['in1', 'in2', 'in3']}}}} mock_input.return_value=1234 @@ -2074,7 +2080,7 @@ def test_177__print_ctan_instructions(self, mock_input, mock_show, mock_stdout): @unittest.mock.patch('sys.stdout', new_callable=io.StringIO) @patch('dkb_robo.api.Wrapper._show_image') @patch('builtins.input') - def test_178__print_ctan_instructions(self, mock_input, mock_show, mock_stdout): + def test_179__print_ctan_instructions(self, mock_input, mock_show, mock_stdout): """ test _print_ctan_instructions()""" challenge_dic = {'data': {'attributes': {'chipTan': {'qrData': 'qrData', 'headline': 'headline', 'instructions': ['in1', 'in2', 'in3']}}}} mock_input.return_value=1234 @@ -2083,20 +2089,20 @@ def test_178__print_ctan_instructions(self, mock_input, mock_show, mock_stdout): self.assertTrue(mock_show.called) @patch("PIL.Image.open") - def test_179__print_ctan_instructions(self, mock_open): + def test_180__print_ctan_instructions(self, mock_open): """ test _print_ctan_instructions()""" self.assertFalse(self.dkb._show_image('cXJEYXRh')) self.assertTrue(mock_open.called) - def test_180__docfilename_lookup(self): + def test_181__docfilename_lookup(self): """ test _docfilename_lookup()""" self.assertEqual('filename', self.dkb._docfilename_lookup({'attributes': {'fileName': 'filename', 'metadata': {'statementDate': 'statementDate'}}})) - def test_181__docfilename_lookup(self): + def test_182__docfilename_lookup(self): """ test _docfilename_lookup()""" self.assertEqual('filename', self.dkb._docfilename_lookup({'attributes': {'fileName': 'filename', 'metadata': {'statementDate': 'statementDate', 'subject': 'subject'}}})) - def test_182__docfilename_lookup(self): + def test_183__docfilename_lookup(self): """ test _docfilename_lookup()""" self.assertEqual('subject', self.dkb._docfilename_lookup({'attributes': {'fileName': 'filename', 'metadata': {'statementDate': 'statementDate', 'dwpDocumentId': 'dwpDocumentId', 'subject': 'subject'}}}))