mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-03 22:20:28 +03:00 
			
		
		
		
	test load_localized_config() with categories
This commit is contained in:
		
							parent
							
								
									bc58959315
								
							
						
					
					
						commit
						6b82710039
					
				
					 6 changed files with 76 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -546,6 +546,7 @@ include tests/checkupdates.TestCase
 | 
			
		|||
include tests/common.TestCase
 | 
			
		||||
include tests/config.py
 | 
			
		||||
include tests/config/antiFeatures.yml
 | 
			
		||||
include tests/config/categories.yml
 | 
			
		||||
include tests/config/de/antiFeatures.yml
 | 
			
		||||
include tests/config/fa/antiFeatures.yml
 | 
			
		||||
include tests/config/ic_antifeature_ads.xml
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2694,6 +2694,23 @@ class CommonTest(unittest.TestCase):
 | 
			
		|||
            p = Path(os.path.dirname(__file__) + '/repo' + v['icon']['en-US']['name'])
 | 
			
		||||
            self.assertTrue(p.exists())
 | 
			
		||||
 | 
			
		||||
    def test_load_localized_config_categories(self):
 | 
			
		||||
        """It should load"""
 | 
			
		||||
        categories = fdroidserver.common.load_localized_config('categories', 'repo')
 | 
			
		||||
        self.assertEqual(
 | 
			
		||||
            [
 | 
			
		||||
                'Time',
 | 
			
		||||
                'Development',
 | 
			
		||||
                'GuardianProject',
 | 
			
		||||
                'Multimedia',
 | 
			
		||||
                'Phone & SMS',
 | 
			
		||||
                'Security',
 | 
			
		||||
                'System',
 | 
			
		||||
            ],
 | 
			
		||||
            list(categories.keys()),
 | 
			
		||||
        )
 | 
			
		||||
        self.assertEqual(['en-US'], list(categories['GuardianProject']['name'].keys()))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    os.chdir(os.path.dirname(__file__))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										14
									
								
								tests/config/categories.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								tests/config/categories.yml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
Time:
 | 
			
		||||
  name: Time
 | 
			
		||||
Development:
 | 
			
		||||
  name: Development
 | 
			
		||||
GuardianProject:
 | 
			
		||||
  name: Guardian Project
 | 
			
		||||
Multimedia:
 | 
			
		||||
  name: Multimedia
 | 
			
		||||
Phone & SMS:
 | 
			
		||||
  name: Phone & SMS
 | 
			
		||||
Security:
 | 
			
		||||
  name: Security
 | 
			
		||||
System:
 | 
			
		||||
  name: System
 | 
			
		||||
| 
						 | 
				
			
			@ -3,8 +3,8 @@
 | 
			
		|||
  "version": 20002,
 | 
			
		||||
  "index": {
 | 
			
		||||
    "name": "/index-v2.json",
 | 
			
		||||
    "sha256": "ba000a3f5e1935d338f374c50cae529b8ce6d988ab3ed67c7a8cf437502f81ad",
 | 
			
		||||
    "size": 52481,
 | 
			
		||||
    "sha256": "7117ee6ff4ff2dd71ec3f3d3ad2ef7e9fd4afead9b1f2d39d0b224a1812e78b5",
 | 
			
		||||
    "size": 53233,
 | 
			
		||||
    "numPackages": 10
 | 
			
		||||
  },
 | 
			
		||||
  "diffs": {}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -498,6 +498,43 @@
 | 
			
		|||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "categories": {
 | 
			
		||||
      "Time": {
 | 
			
		||||
        "name": {
 | 
			
		||||
          "en-US": "Time"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "Development": {
 | 
			
		||||
        "name": {
 | 
			
		||||
          "en-US": "Development"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "GuardianProject": {
 | 
			
		||||
        "name": {
 | 
			
		||||
          "en-US": "Guardian Project"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "Multimedia": {
 | 
			
		||||
        "name": {
 | 
			
		||||
          "en-US": "Multimedia"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "Phone & SMS": {
 | 
			
		||||
        "name": {
 | 
			
		||||
          "en-US": "Phone & SMS"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "Security": {
 | 
			
		||||
        "name": {
 | 
			
		||||
          "en-US": "Security"
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      "System": {
 | 
			
		||||
        "name": {
 | 
			
		||||
          "en-US": "System"
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
    },
 | 
			
		||||
    "requests": {
 | 
			
		||||
      "install": [
 | 
			
		||||
        "org.adaway"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -702,7 +702,11 @@ echo "Description: |" >> metadata/fake.yml
 | 
			
		|||
echo " this is fake" >> metadata/fake.yml
 | 
			
		||||
 | 
			
		||||
# fake that no JDKs are available
 | 
			
		||||
echo 'java_paths: {}' > config.yml
 | 
			
		||||
cat > config.yml <<EOF
 | 
			
		||||
categories:
 | 
			
		||||
  - Internet
 | 
			
		||||
java_paths: {}
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
LOCAL_COPY_DIR=`create_test_dir`/fdroid
 | 
			
		||||
mkdir -p $LOCAL_COPY_DIR/repo
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue