Initial parallelization attempt
This commit is contained in:
parent
12c05afa57
commit
35e49044f1
10 changed files with 321 additions and 143 deletions
|
|
@ -62,7 +62,7 @@ class TestISO(unittest.TestCase):
|
|||
{'start': 1024, 'end': 2048, 'enc': False}
|
||||
]
|
||||
|
||||
with mock.patch('iso.ird.IRD', return_value=ird) as mock_ird:
|
||||
with mock.patch('libray.iso.ird.IRD', return_value=ird) as mock_ird:
|
||||
returned_key = fake_iso.get_key_from_args('AAA', mock_args)
|
||||
mock_ird.assert_called_once_with('aaa.ird')
|
||||
self.assertEqual(decryptkey_bytes, returned_key)
|
||||
|
|
@ -84,7 +84,7 @@ class TestISO(unittest.TestCase):
|
|||
{'start': 0, 'end': 512, 'enc': False},
|
||||
]
|
||||
|
||||
with mock.patch('iso.ird.IRD', return_value=ird) as mock_ird:
|
||||
with mock.patch('libray.iso.ird.IRD', return_value=ird) as mock_ird:
|
||||
with self.assertRaises(SystemExit):
|
||||
fake_iso.get_key_from_args('AAA', mock_args)
|
||||
|
||||
|
|
@ -107,7 +107,7 @@ class TestISO(unittest.TestCase):
|
|||
{'start': 2000000000, 'end': 2000001000, 'enc': False}
|
||||
]
|
||||
|
||||
with mock.patch('iso.ird.IRD', return_value=ird) as mock_ird:
|
||||
with mock.patch('libray.iso.ird.IRD', return_value=ird) as mock_ird:
|
||||
with self.assertRaises(SystemExit):
|
||||
fake_iso.get_key_from_args('AAA', mock_args)
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ class TestISO(unittest.TestCase):
|
|||
fake_iso.size = 512 * 1024 * 1024
|
||||
fake_iso.game_id = 'TCUS-12345'
|
||||
|
||||
with mock.patch('iso.sqlite3') as mocksql:
|
||||
with mock.patch('libray.iso.sqlite3') as mocksql:
|
||||
decryption_key = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
decryptkey_bytes = core.to_bytes(decryption_key)
|
||||
mocksql.connect().cursor().execute().fetchall.return_value = [['AAA', decryptkey_bytes]]
|
||||
|
|
@ -140,7 +140,7 @@ class TestISO(unittest.TestCase):
|
|||
fake_iso.size = 512 * 1024 * 1024
|
||||
fake_iso.game_id = 'TCUS-12345'
|
||||
|
||||
with mock.patch('iso.sqlite3') as mocksql:
|
||||
with mock.patch('libray.iso.sqlite3') as mocksql:
|
||||
decryption_key = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
decryptkey_bytes = core.to_bytes(decryption_key)
|
||||
mocksql.connect().cursor().execute().fetchall.side_effect = [[], [['AAA', decryptkey_bytes]]]
|
||||
|
|
@ -158,7 +158,7 @@ class TestISO(unittest.TestCase):
|
|||
fake_iso.size = 512 * 1024 * 1024
|
||||
fake_iso.game_id = 'TCUS-12345'
|
||||
|
||||
with mock.patch('iso.sqlite3') as mocksql:
|
||||
with mock.patch('libray.iso.sqlite3') as mocksql:
|
||||
decryption_key = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
decryptkey_bytes = core.to_bytes(decryption_key)
|
||||
mocksql.connect().cursor().execute().fetchall.return_value = [['AAA', decryptkey_bytes],['BBB', decryptkey_bytes]]
|
||||
|
|
@ -177,7 +177,7 @@ class TestISO(unittest.TestCase):
|
|||
fake_iso.size = 512 * 1024 * 1024
|
||||
fake_iso.game_id = 'TCUS-12345'
|
||||
|
||||
with mock.patch('iso.sqlite3') as mocksql:
|
||||
with mock.patch('libray.iso.sqlite3') as mocksql:
|
||||
mocksql.connect().cursor().execute().fetchall.return_value = []
|
||||
with self.assertRaises(SystemExit):
|
||||
fake_iso.get_key_from_args('AAA', mock_args)
|
||||
|
|
@ -195,12 +195,12 @@ class TestISO(unittest.TestCase):
|
|||
fake_iso.size = 512 * 1024 * 1024
|
||||
fake_iso.game_id = 'TCUS-12345'
|
||||
|
||||
with mock.patch('iso.sqlite3') as mocksql:
|
||||
with mock.patch('libray.iso.sqlite3') as mocksql:
|
||||
decryption_key = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
|
||||
decryptkey_bytes = core.to_bytes(decryption_key)
|
||||
fakeresults = ([], [], [['AAA', decryptkey_bytes]])
|
||||
mocksql.connect().cursor().execute().fetchall.side_effect = fakeresults
|
||||
with mock.patch('iso.core.crc32', return_value='01010101'):
|
||||
with mock.patch('libray.iso.core.crc32', return_value='01010101'):
|
||||
returned_key = fake_iso.get_key_from_args('AAA', mock_args)
|
||||
self.assertEqual(decryptkey_bytes, returned_key)
|
||||
|
||||
|
|
@ -217,9 +217,9 @@ class TestISO(unittest.TestCase):
|
|||
fake_iso.size = 512 * 1024 * 1024
|
||||
fake_iso.game_id = 'TCUS-12345'
|
||||
|
||||
with mock.patch('iso.sqlite3') as mocksql:
|
||||
with mock.patch('libray.iso.sqlite3') as mocksql:
|
||||
mocksql.connect().cursor().execute().fetchall.return_value = []
|
||||
with mock.patch('iso.core.crc32', return_value=None):
|
||||
with mock.patch('libray.iso.core.crc32', return_value=None):
|
||||
with self.assertRaises(TimeoutError):
|
||||
fake_iso.get_key_from_args('AAA', mock_args)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue