label cleanup periodic job

This commit is contained in:
Chris Meyers
2016-04-05 12:24:13 -04:00
parent 2d9e34162c
commit 68c14976db
7 changed files with 85 additions and 1 deletions
+12
View File
@@ -0,0 +1,12 @@
from awx.main.tasks import run_label_cleanup
def test_run_label_cleanup(mocker):
qs = mocker.Mock(**{'count.return_value': 3, 'delete.return_value': None})
mock_label = mocker.patch('awx.main.models.label.Label.get_orphaned_labels',return_value=qs)
ret = run_label_cleanup()
mock_label.assert_called_with()
qs.delete.assert_called_with()
assert 3 == ret