From 8ac88facab854bbe3a9d2170e5cc0401b79cb167 Mon Sep 17 00:00:00 2001 From: Jake Moshenko Date: Mon, 1 Aug 2016 18:42:55 -0400 Subject: [PATCH] Add a test to make sure the random policy function runs. --- test/test_gc.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/test_gc.py b/test/test_gc.py index e7646dc99..ce9f13e98 100644 --- a/test/test_gc.py +++ b/test/test_gc.py @@ -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. """