|
4 | 4 |
|
5 | 5 |
|
6 | 6 | class TestGetTdjsonTdlibPath:
|
7 |
| - def test_for_darwin(self): |
| 7 | + def test_for_darwin_x86_64(self): |
8 | 8 | mocked_system = Mock(return_value='Darwin')
|
| 9 | + mocked_machine_name = Mock(return_value='x86_64') |
9 | 10 | mocked_resource = Mock()
|
10 | 11 | mocked_find_library = Mock(return_value=None)
|
11 | 12 |
|
12 | 13 | with patch('telegram.tdjson.platform.system', mocked_system):
|
13 |
| - with patch('telegram.tdjson.pkg_resources.resource_filename', mocked_resource): |
14 |
| - with patch('telegram.tdjson.ctypes.util.find_library', mocked_find_library): |
15 |
| - _get_tdjson_lib_path() |
| 14 | + with patch('telegram.tdjson.platform.machine', mocked_machine_name): |
| 15 | + with patch('telegram.tdjson.pkg_resources.resource_filename', mocked_resource): |
| 16 | + with patch('telegram.tdjson.ctypes.util.find_library', mocked_find_library): |
| 17 | + _get_tdjson_lib_path() |
| 18 | + |
| 19 | + mocked_resource.assert_called_once_with('telegram', 'lib/darwin/x86_64/libtdjson.dylib') |
| 20 | + |
| 21 | + def test_for_darwin_arm64(self): |
| 22 | + mocked_system = Mock(return_value='Darwin') |
| 23 | + mocked_machine_name = Mock(return_value='arm64') |
| 24 | + mocked_resource = Mock() |
| 25 | + mocked_find_library = Mock(return_value=None) |
| 26 | + |
| 27 | + with patch('telegram.tdjson.platform.system', mocked_system): |
| 28 | + with patch('telegram.tdjson.platform.machine', mocked_machine_name): |
| 29 | + with patch('telegram.tdjson.pkg_resources.resource_filename', mocked_resource): |
| 30 | + with patch('telegram.tdjson.ctypes.util.find_library', mocked_find_library): |
| 31 | + _get_tdjson_lib_path() |
16 | 32 |
|
17 |
| - mocked_resource.assert_called_once_with('telegram', 'lib/darwin/libtdjson.dylib') |
| 33 | + mocked_resource.assert_called_once_with('telegram', 'lib/darwin/arm64/libtdjson.dylib') |
18 | 34 |
|
19 | 35 | def test_for_linux(self):
|
20 | 36 | mocked_system = Mock(return_value='Linux')
|
|
0 commit comments