Skip to content

Commit 30ab490

Browse files
committed
[test] Add test for Distribution.update_dist_project_properties_android_api
1 parent b5c46ce commit 30ab490

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_distribution.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,25 @@ def test_update_dist_info(self, mock_open, mock_json):
139139
new_info_data, expected_json_file, indent=4, sort_keys=True,
140140
)
141141

142+
@mock.patch("pythonforandroid.distribution.open", create=True)
143+
def test_update_dist_project_properties_android_api(self, mock_open):
144+
"""Test that method
145+
:meth:`~pythonforandroid.distribution.Distribution.update_dist_project_properties_android_api`
146+
calls the proper methods with the right arguments."""
147+
self.setUp_distribution_with_bootstrap(
148+
Bootstrap().get_bootstrap("sdl2", self.ctx)
149+
)
150+
mocked_file_obj = mock.mock_open(read_data=json.dumps(dist_info_data))
151+
mock_open.side_effect = [mocked_file_obj.return_value]
152+
new_android_api = 28
153+
self.ctx.bootstrap.distribution.update_dist_project_properties_android_api( # noqa
154+
new_android_api
155+
)
156+
self.assertTrue(mock_open.call_args[0][0].endswith(
157+
'dists/test_prj__armeabi-v7a/project.properties')
158+
)
159+
self.assertEqual(mock_open.call_args[0][1], 'w')
160+
142161
@mock.patch("pythonforandroid.distribution.exists")
143162
def test_folder_exist(self, mock_exists):
144163
"""Test that method

0 commit comments

Comments
 (0)