@@ -1913,6 +1913,41 @@ def test_auto_defined_categories(self):
19131913 index ['repo' ][CATEGORIES_CONFIG_NAME ],
19141914 )
19151915
1916+ def test_categories_with_only_icon_defined (self ):
1917+ """If cateogories.yml only includes the icon, the name should be added."""
1918+ os .chdir (self .testdir )
1919+ os .mkdir ('config' )
1920+ os .mkdir ('metadata' )
1921+ os .mkdir ('repo' )
1922+ fdroidserver .common .write_config_file (
1923+ 'repo_pubkey: ffffffffffffffffffffffffffffffffffffffff\n '
1924+ )
1925+ testvalue = 'Time'
1926+ Path ('config/time.png' ).write_text ('placeholder' )
1927+ Path ('config/categories.yml' ).write_text (testvalue + ': {icon: time.png}' )
1928+
1929+ testapk = os .path .join ('repo' , 'com.politedroid_6.apk' )
1930+ shutil .copy (basedir / testapk , testapk )
1931+ Path ('metadata/com.politedroid.yml' ).write_text (f'Categories: [{ testvalue } ]' )
1932+
1933+ with mock .patch ('sys.argv' , ['fdroid update' , '--delete-unknown' , '--nosign' ]):
1934+ fdroidserver .update .main ()
1935+ with open ('repo/index-v2.json' ) as fp :
1936+ index = json .load (fp )
1937+ self .assertEqual (
1938+ {
1939+ 'icon' : {
1940+ 'en-US' : {
1941+ 'name' : '/icons/time.png' ,
1942+ 'sha256' : '4097889236a2af26c293033feb964c4cf118c0224e0d063fec0a89e9d0569ef2' ,
1943+ 'size' : 11 ,
1944+ }
1945+ },
1946+ 'name' : {'en-US' : testvalue },
1947+ },
1948+ index ['repo' ][CATEGORIES_CONFIG_NAME ][testvalue ],
1949+ )
1950+
19161951 def test_auto_defined_categories_two_apps (self ):
19171952 """Repos that don't define categories in config/ should use auto-generated."""
19181953 os .chdir (self .testdir )
0 commit comments