🏟️ add test for _parse_from_pbxproj

Also fix lint issues
This commit is contained in:
Michael Pöhn 2024-04-04 13:53:02 +02:00
parent 450765490b
commit f742799a9d
No known key found for this signature in database
GPG key ID: 725F386C05529A5A
3 changed files with 26 additions and 4 deletions

View file

@ -2223,11 +2223,29 @@ class TestGetIpaIcon(unittest.TestCase):
""")
pfp = mock.Mock(return_value="fake_icon")
with(mock.patch("fdroidserver.update._parse_from_pbxproj", pfp)):
with mock.patch("fdroidserver.update._parse_from_pbxproj", pfp):
p = fdroidserver.update._get_ipa_icon(tmpdir)
self.assertEqual(str(icondir / "yep"), p)
class TestParseFromPbxproj(unittest.TestCase):
def test_parse_from_pbxproj(self):
self.maxDiff = None
with tempfile.TemporaryDirectory() as tmpdir:
with open(Path(tmpdir) / "asdf.pbxproj", 'w', encoding="utf-8") as f:
f.write("""
230jfaod=flc'
ASSETCATALOG_COMPILER_APPICON_NAME = MyIcon;
cm opa1c p[m
""")
v = fdroidserver.update._parse_from_pbxproj(
Path(tmpdir) / "asdf.pbxproj",
"ASSETCATALOG_COMPILER_APPICON_NAME"
)
self.assertEqual(v, "MyIcon")
if __name__ == "__main__":
os.chdir(os.path.dirname(__file__))