示例#1
0
 def test_no_cleanup_when_build_has_keep_data_checked(self, cleanup_build):
     build = self.create_build('1',
                               timezone.now() - timezone.timedelta(210))
     build.keep_data = True
     build.save()
     cleanup_old_builds()
     cleanup_build.delay.assert_not_called()
示例#2
0
    def test_cleanup_old_builds_does_not_delete_builds_from_other_projects(self, cleanup_build):
        seven_months_ago = timezone.now() - timezone.timedelta(210)

        other_project = self.group.projects.create(slug='otherproject')
        self.create_build('1', created_at=seven_months_ago, project=other_project)
        cleanup_old_builds()
        cleanup_build.delay.assert_not_called()
示例#3
0
 def test_no_cleanup_with_non_positive_data_retention_days(
         self, cleanup_build):
     self.project.data_retention_days = 0
     self.project.save()
     self.create_build('1', timezone.now() - timezone.timedelta(210))
     cleanup_old_builds()
     cleanup_build.delay.assert_not_called()
示例#4
0
    def test_cleanup_old_builds_does_not_delete_builds_from_other_projects(self, cleanup_build):
        seven_months_ago = timezone.now() - timezone.timedelta(210)

        other_project = self.group.projects.create(slug='otherproject')
        self.create_build('1', created_at=seven_months_ago, project=other_project)
        cleanup_old_builds()
        cleanup_build.delay.assert_not_called()
示例#5
0
 def test_cleanup_old_builds_respects_data_retention_policy(self, cleanup_build):
     build = self.create_build('1', timezone.now() - timezone.timedelta(90))
     cleanup_old_builds()
     cleanup_build.delay.assert_not_called()
     self.project.data_retention_days = 60
     self.project.save()
     cleanup_old_builds()
     cleanup_build.delay.assert_called_once_with(build.id)
示例#6
0
 def test_cleanup_old_builds_respects_data_retention_policy(self, cleanup_build):
     build = self.create_build('1', timezone.now() - timezone.timedelta(90))
     cleanup_old_builds()
     cleanup_build.delay.assert_not_called()
     self.project.data_retention_days = 60
     self.project.save()
     cleanup_old_builds()
     cleanup_build.delay.assert_called_once_with(build.id)
示例#7
0
 def test_cleanup_old_builds(self, cleanup_build):
     seven_months_ago = timezone.now() - timezone.timedelta(210)
     old_build = self.create_build('1', seven_months_ago)
     self.create_build('2')  # new build, should be kept
     cleanup_old_builds()
     cleanup_build.delay.assert_called_once_with(old_build.id)
示例#8
0
 def test_no_cleanup_when_build_has_keep_data_checked(self, cleanup_build):
     build = self.create_build('1', timezone.now() - timezone.timedelta(210))
     build.keep_data = True
     build.save()
     cleanup_old_builds()
     cleanup_build.delay.assert_not_called()
示例#9
0
 def test_no_cleanup_with_non_positive_data_retention_days(self, cleanup_build):
     self.project.data_retention_days = 0
     self.project.save()
     self.create_build('1', timezone.now() - timezone.timedelta(210))
     cleanup_old_builds()
     cleanup_build.delay.assert_not_called()
示例#10
0
 def test_cleanup_old_builds(self, cleanup_build):
     seven_months_ago = timezone.now() - timezone.timedelta(210)
     old_build = self.create_build('1', seven_months_ago)
     self.create_build('2')  # new build, should be kept
     cleanup_old_builds()
     cleanup_build.delay.assert_called_once_with(old_build.id)