Beispiel #1
0
    def test_new_no_delete(self, public_mock, private_mock):
        public_mock.listdir.return_value = (['dirlol'], ['lol'])
        public_mock.modified_time.return_value = self.days_ago(1)

        mkt_gc()
        assert not public_mock.delete.called
        assert not private_mock.delete.called
Beispiel #2
0
    def test_new_no_delete(self, public_mock, private_mock):
        public_mock.listdir.return_value = (['dirlol'], ['lol'])
        public_mock.modified_time.return_value = self.days_ago(1)

        mkt_gc()
        assert not public_mock.delete.called
        assert not private_mock.delete.called
Beispiel #3
0
    def test_old_no_path(self, rm_mock, ls_mock, stat_mock):
        fu_old = FileUpload.objects.create(path='', name='foo')
        fu_old.update(created=self.days_ago(91))

        mkt_gc()

        eq_(FileUpload.objects.count(), 0)
        assert not rm_mock.called
Beispiel #4
0
    def test_old_no_path(self, rm_mock, ls_mock, stat_mock):
        fu_old = FileUpload.objects.create(path='', name='foo')
        fu_old.update(created=self.days_ago(91))

        mkt_gc()

        eq_(FileUpload.objects.count(), 0)
        assert not rm_mock.called
Beispiel #5
0
    def test_dump_delete_private(self, public_mock, private_mock):
        private_mock.listdir.return_value = (['dirlol'], ['lol'])
        private_mock.modified_time.return_value = self.days_ago(1000)

        mkt_gc()
        assert private_mock.delete.called
        assert not public_mock.delete.called
        assert private_mock.delete.call_args_list[0][0][0].endswith('lol')
Beispiel #6
0
    def test_dump_delete_private(self, public_mock, private_mock):
        private_mock.listdir.return_value = (['dirlol'], ['lol'])
        private_mock.modified_time.return_value = self.days_ago(1000)

        mkt_gc()
        assert private_mock.delete.called
        assert not public_mock.delete.called
        assert private_mock.delete.call_args_list[0][0][0].endswith('lol')
Beispiel #7
0
    def test_old_no_path(self, public_mock, private_mock):
        fu_old = FileUpload.objects.create(path='', name='foo')
        fu_old.update(created=self.days_ago(91))

        mkt_gc()

        eq_(FileUpload.objects.count(), 0)
        assert not private_mock.delete.called
        assert not public_mock.delete.called
Beispiel #8
0
    def test_old_no_path(self, public_mock, private_mock):
        fu_old = FileUpload.objects.create(path='', name='foo')
        fu_old.update(created=self.days_ago(91))

        mkt_gc()

        eq_(FileUpload.objects.count(), 0)
        assert not private_mock.delete.called
        assert not public_mock.delete.called
Beispiel #9
0
    def test_old_and_new(self, rm_mock, ls_mock, stat_mock):
        fu_new = FileUpload.objects.create(path='/tmp/bar', name='bar')
        fu_new.created = self.days_ago(5)
        fu_old = FileUpload.objects.create(path='/tmp/foo', name='foo')
        fu_old.update(created=self.days_ago(91))

        mkt_gc()

        eq_(FileUpload.objects.count(), 1)
        assert rm_mock.called
        eq_(rm_mock.call_args[0][0], fu_old.path)
Beispiel #10
0
    def test_old_and_new(self, rm_mock, ls_mock, stat_mock):
        fu_new = FileUpload.objects.create(path='/tmp/bar', name='bar')
        fu_new.created = self.days_ago(5)
        fu_old = FileUpload.objects.create(path='/tmp/foo', name='foo')
        fu_old.update(created=self.days_ago(91))

        mkt_gc()

        eq_(FileUpload.objects.count(), 1)
        assert rm_mock.called
        eq_(rm_mock.call_args[0][0], fu_old.path)
Beispiel #11
0
    def test_old_and_new(self, public_mock, private_mock):
        fu_new = FileUpload.objects.create(path='/tmp/bar', name='bar')
        fu_new.created = self.days_ago(5)
        fu_old = FileUpload.objects.create(path='/tmp/foo', name='foo')
        fu_old.update(created=self.days_ago(91))

        mkt_gc()

        eq_(FileUpload.objects.count(), 1)
        assert private_mock.delete.called
        assert not public_mock.delete.called
        eq_(private_mock.delete.call_args[0][0], fu_old.path)
Beispiel #12
0
    def test_old_and_new(self, public_mock, private_mock):
        fu_new = FileUpload.objects.create(path='/tmp/bar', name='bar')
        fu_new.created = self.days_ago(5)
        fu_old = FileUpload.objects.create(path='/tmp/foo', name='foo')
        fu_old.update(created=self.days_ago(91))

        mkt_gc()

        eq_(FileUpload.objects.count(), 1)
        assert private_mock.delete.called
        assert not public_mock.delete.called
        eq_(private_mock.delete.call_args[0][0], fu_old.path)
Beispiel #13
0
 def test_nonce(self, rm_mock, ls_mock, stat_mock):
     nonce = Nonce.objects.create(nonce='a', timestamp=1, client_key='b')
     nonce.update(created=self.days_ago(2))
     eq_(Nonce.objects.count(), 1)
     mkt_gc()
     eq_(Nonce.objects.count(), 0)
Beispiel #14
0
 def test_garbage_collection(self, rm_mock, ls_mock, stat_mock):
     eq_(ActivityLog.objects.all().count(), 1)
     mkt_gc()
     eq_(ActivityLog.objects.all().count(), 0)
Beispiel #15
0
    def test_dump_delete(self, rm_mock, ls_mock, stat_mock):
        ls_mock.return_value = ['lol']
        stat_mock.return_value = StatMock(days_ago=1000)

        mkt_gc()
        assert rm_mock.call_args_list[0][0][0].endswith('lol')
Beispiel #16
0
    def test_new_no_delete(self, rm_mock, ls_mock, stat_mock):
        ls_mock.return_value = ['lol']
        stat_mock.return_value = StatMock(days_ago=1)

        mkt_gc()
        assert not rm_mock.called
Beispiel #17
0
    def test_dump_delete(self, rm_mock, ls_mock, stat_mock):
        ls_mock.return_value = ['lol']
        stat_mock.return_value = StatMock(days_ago=1000)

        mkt_gc()
        assert rm_mock.call_args_list[0][0][0].endswith('lol')
Beispiel #18
0
 def test_garbage_collection(self, rm_mock, ls_mock, stat_mock):
     eq_(ActivityLog.objects.all().count(), 1)
     mkt_gc()
     eq_(ActivityLog.objects.all().count(), 0)
Beispiel #19
0
    def test_new_no_delete(self, rm_mock, ls_mock, stat_mock):
        ls_mock.return_value = ['lol']
        stat_mock.return_value = StatMock(days_ago=1)

        mkt_gc()
        assert not rm_mock.called
Beispiel #20
0
 def test_garbage_collection(self, public_mock, private_mock):
     eq_(ActivityLog.objects.all().count(), 1)
     mkt_gc()
     eq_(ActivityLog.objects.all().count(), 0)
Beispiel #21
0
 def test_nonce(self, public_mock, private_mock):
     nonce = Nonce.objects.create(nonce='a', timestamp=1, client_key='b')
     nonce.update(created=self.days_ago(2))
     eq_(Nonce.objects.count(), 1)
     mkt_gc()
     eq_(Nonce.objects.count(), 0)
Beispiel #22
0
 def test_garbage_collection(self, public_mock, private_mock):
     eq_(ActivityLog.objects.all().count(), 1)
     mkt_gc()
     eq_(ActivityLog.objects.all().count(), 0)