857
855
self._test_AnswerContactPruner(
858
856
AccountStatus.SUSPENDED, ONE_DAY_AGO, expected_count=1)
860
def test_populate_transitively_private(self):
861
# Test garbo job to populate the branch transitively_private column.
863
# First delete any existing column data and add stacked branches.
864
# Branches 29 and 30 are explicitly private to start with.
865
con = DatabaseLayer._db_fixture.superuser_connection()
868
cur.execute("UPDATE branch set stacked_on=29 where id = 5")
869
cur.execute("UPDATE branch set stacked_on=5 where id = 1")
870
cur.execute("UPDATE branch set transitively_private=NULL")
874
store = IMasterStore(Branch)
875
unmigrated = store.find(
876
Branch, Branch.transitively_private == None).count
877
self.assertNotEqual(0, unmigrated())
879
self.assertEqual(0, unmigrated())
880
# Check the branches that now should be transitively private.
881
self.assertEqual(4, store.find(
883
And(Branch.transitively_private == True,
884
Branch.id.is_in([1, 5, 29, 30]))
886
# Check the branches that now should not be transitively private.
887
self.assertEqual(26, store.find(
889
And(Branch.transitively_private == False,
893
858
def test_BranchJobPruner(self):
894
859
# Garbo should remove jobs completed over 30 days ago.
895
860
LaunchpadZopelessLayer.switchDbUser('testadmin')