Add isolated Liam persona test APK profile
This commit is contained in:
@@ -22,12 +22,13 @@ class CharacterProfilesTests(unittest.TestCase):
|
||||
return select.selection(ASSETS, profile, **flags)
|
||||
|
||||
def test_identities_are_distinct_media_is_identical(self):
|
||||
main, lvbu = self.full(), self.full('lvbu-test')
|
||||
self.assertEqual(main['files'], lvbu['files'])
|
||||
self.assertEqual(lvbu['file_count'], 4051)
|
||||
self.assertEqual((main['persona'], lvbu['persona']), ('default', 'lvbu'))
|
||||
self.assertNotEqual(main['application_id'], lvbu['application_id'])
|
||||
self.assertEqual((main['media_identity'], lvbu['media_identity']), ('a01', 'a01'))
|
||||
results=[self.full(p) for p in ('main','lvbu-test','liam-test')]
|
||||
for row in results:
|
||||
self.assertEqual(results[0]['files'],row['files'])
|
||||
self.assertEqual((row['file_count'],row['media_identity']),(4051,'a01'))
|
||||
self.assertEqual([r['persona'] for r in results],['default','lvbu','liam'])
|
||||
self.assertEqual(len({r['application_id'] for r in results}),3)
|
||||
self.assertEqual(results[2]['application_id'],'com.gorios.lanvoice.liamtest')
|
||||
self.assertNotIn('voice_id', json.dumps(select.catalog()))
|
||||
|
||||
def test_complete_inventory_is_exact_code33(self):
|
||||
@@ -55,9 +56,9 @@ class CharacterProfilesTests(unittest.TestCase):
|
||||
self.assertEqual(select.selection(copied)['files'], select.selection(ASSETS)['files'])
|
||||
|
||||
def test_wrong_persona_flags_or_pin_are_rejected(self):
|
||||
for profile, changes in [('unknown', {}), ('lvbu-test', {'startup': False}),
|
||||
('lvbu-test', {'mouth': False}), ('lvbu-test', {'user_assets': False}),
|
||||
('main', {'emotion_sha': '0'*64})]:
|
||||
cases=[('unknown',{}),('main',{'emotion_sha':'0'*64})]
|
||||
cases += [(p,{flag:False}) for p in ('lvbu-test','liam-test') for flag in ('startup','mouth','user_assets')]
|
||||
for profile, changes in cases:
|
||||
with self.subTest(profile=profile, changes=changes), self.assertRaises(ValueError):
|
||||
self.full(profile, **changes)
|
||||
|
||||
@@ -83,17 +84,20 @@ class CharacterProfilesTests(unittest.TestCase):
|
||||
select.relative(name)
|
||||
|
||||
def test_staging_cannot_overwrite_other_profile_or_build_root(self):
|
||||
result = self.full('lvbu-test')
|
||||
for dest in (ROOT/'app/build', ROOT/'app/build/generated/packagedAssets', ASSETS):
|
||||
with self.subTest(dest=dest), self.assertRaises(ValueError):
|
||||
select.stage(ASSETS, dest, result)
|
||||
for profile,other in [('lvbu-test','liam-test'),('liam-test','lvbu-test')]:
|
||||
result=self.full(profile)
|
||||
for dest in (ROOT/'app/build',ROOT/'app/build/generated/packagedAssets',ASSETS,
|
||||
ROOT/'app/build/characters'/other/'generated/packagedAssets'):
|
||||
with self.subTest(profile=profile,dest=dest),self.assertRaises(ValueError):
|
||||
select.stage(ASSETS,dest,result)
|
||||
|
||||
def test_backup_lifecycle_component_contracts(self):
|
||||
profiles = select.catalog()['profiles']
|
||||
self.assertTrue(profiles['main']['allowBackup'])
|
||||
self.assertTrue(profiles['main']['permissionConnectionRetention'])
|
||||
self.assertFalse(profiles['lvbu-test']['allowBackup'])
|
||||
self.assertFalse(profiles['lvbu-test']['permissionConnectionRetention'])
|
||||
for profile in ('lvbu-test','liam-test'):
|
||||
self.assertFalse(profiles[profile]['allowBackup'])
|
||||
self.assertFalse(profiles[profile]['permissionConnectionRetention'])
|
||||
text = (ROOT/'app/src/main/AndroidManifest.xml').read_text()
|
||||
self.assertIn('android:allowBackup="${characterAllowBackup}"', text)
|
||||
self.assertIn('android:name="com.gorios.lanvoice.MainActivity"', text)
|
||||
@@ -106,3 +110,13 @@ class CharacterProfilesTests(unittest.TestCase):
|
||||
pause=activity[activity.index("override fun onPause()"):activity.index("override fun onStop()")]
|
||||
self.assertLess(pause.index("if(releaseSessionFirst"),pause.index("closeCamera()"))
|
||||
self.assertIn("if(!releaseSessionFirst",pause)
|
||||
|
||||
def test_artifact_names_and_build_directories_are_isolated(self):
|
||||
spec=importlib.util.spec_from_file_location('character_pack',ROOT/'scripts/package-character-test.py')
|
||||
pack=importlib.util.module_from_spec(spec);spec.loader.exec_module(pack)
|
||||
self.assertEqual(pack.artifact_name('lvbu-test',34),'lan-voice-v0714-lvbu-test-code34-arm64-debug.apk')
|
||||
self.assertEqual(pack.artifact_name('liam-test',35),'lan-voice-v0714-liam-test-code35-arm64-debug.apk')
|
||||
self.assertNotEqual(pack.build_dir('liam-test'),pack.build_dir('lvbu-test'))
|
||||
self.assertIn('-PcharacterProfile=liam-test',pack.flags('liam-test',35))
|
||||
self.assertEqual(select.catalog()['profiles']['liam-test']['minimumVersionCode'],35)
|
||||
with self.assertRaises(ValueError):pack.artifact_name('main',35)
|
||||
|
||||
Reference in New Issue
Block a user