Merge branch 'bug-663225-clean_up_after_test'

This commit is contained in:
Piotr Zalewa 2011-06-23 22:37:15 +01:00
Родитель 4e2f9fff9e cc11b444fa
Коммит 70a718ab9b
1 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -3,6 +3,7 @@ import os
import tempfile
import commonware
import json
import shutil
import simplejson
import hashlib
@ -46,7 +47,7 @@ class AttachmentTest(TestCase):
self.path = self.attachment.path
def tearDown(self):
os.remove(os.path.join(settings.UPLOAD_DIR, self.path))
shutil.rmtree(settings.UPLOAD_DIR)
settings.UPLOAD_DIR = self.old
def test_export_file(self):
@ -307,13 +308,13 @@ class TestViews(TestCase):
revision = PackageRevision.objects.get(package=self.package,
revision_number=2)
assert not revision.attachments.all().count()
def test_fake_attachment_remove(self):
revision = self.add_one()
data = {'uid': '1337'}
resp = self.client.post(self.get_delete_url(1), data)
eq_(resp.status_code, 404)
def test_attachment_rename(self):
@ -460,19 +461,19 @@ class TestViews(TestCase):
revision = self.get_revision_from_response(response)
eq_(revision.attachments.count(), 1)
eq_(revision.folders.count(), 0)
def test_private_attachments(self):
revision = self.add_one()
revision.package.active = False
revision.package.save()
att = revision.attachments.all()[0]
url = reverse('jp_attachment', args=[att.get_uid])
res = self.client.get(url)
eq_(res.status_code, 200)
self.client.logout()
res = self.client.get(url)
eq_(res.status_code, 403)