Add a test to make sure the random policy function runs.
This commit is contained in:
		
							parent
							
								
									05e2773fa7
								
							
						
					
					
						commit
						8ac88facab
					
				
					 1 changed files with 9 additions and 0 deletions
				
			
		|  | @ -1,6 +1,8 @@ | |||
| import unittest | ||||
| import time | ||||
| 
 | ||||
| from playhouse.test_utils import assert_query_count | ||||
| 
 | ||||
| from app import app, storage | ||||
| from initdb import setup_database_for_testing, finished_database_for_testing | ||||
| from data import model, database | ||||
|  | @ -189,6 +191,13 @@ class TestGarbageCollection(unittest.TestCase): | |||
|     self.assertIsNone(model.repository.find_repository_with_garbage(0)) | ||||
| 
 | ||||
| 
 | ||||
|   def test_find_garbage_policy_functions(self): | ||||
|     with assert_query_count(1): | ||||
|       one_policy = model.repository.get_random_gc_policy() | ||||
|       all_policies = model.repository._get_gc_expiration_policies() | ||||
|     self.assertIn(one_policy, all_policies) | ||||
| 
 | ||||
| 
 | ||||
|   def test_one_tag(self): | ||||
|     """ Create a repository with a single tag, then remove that tag and verify that the repository | ||||
|         is now empty. """ | ||||
|  |  | |||
		Reference in a new issue