Commit a972f8d4f186128425fe13aa30a117707557fe88
1 parent
707b27ef
Exists in
master
and in
5 other branches
Changes in topic model #128 #129 #130
Showing
4 changed files
with
5 additions
and
6 deletions
Show diff stats
files/tests.py
11.5 KB
41 KB
files/tests/tests.py
... | ... | @@ -9,6 +9,9 @@ from files.models import TopicFile |
9 | 9 | from files.forms import FileForm, UpdateFileForm |
10 | 10 | from courses.models import CourseCategory, Course, Subject, Topic |
11 | 11 | |
12 | +import os | |
13 | +FILE_DIR = os.path.dirname(os.path.abspath(__file__)) | |
14 | + | |
12 | 15 | class FileTestCase(TestCase): |
13 | 16 | |
14 | 17 | def setUp(self): |
... | ... | @@ -77,7 +80,6 @@ class FileTestCase(TestCase): |
77 | 80 | name = 'Topic Test', |
78 | 81 | description = "description of the topic test file", |
79 | 82 | subject = self.subject, |
80 | - owner = self.teacher, | |
81 | 83 | ) |
82 | 84 | self.topic.save() |
83 | 85 | |
... | ... | @@ -85,7 +87,7 @@ class FileTestCase(TestCase): |
85 | 87 | Manual upload file |
86 | 88 | Change directory for a file in your computer and be happy... |
87 | 89 | """ |
88 | - upload_file = open('/home/ailson/Pictures/teste.png', 'rb') | |
90 | + upload_file = open( '/'.join([FILE_DIR, 'files/teste.png']), 'rb') | |
89 | 91 | self.file = SimpleUploadedFile(upload_file.name, upload_file.read()) |
90 | 92 | |
91 | 93 | def test_create_file_ok(self): |
... | ... | @@ -134,7 +136,7 @@ class FileTestCase(TestCase): |
134 | 136 | |
135 | 137 | url = reverse('course:file:update_file',kwargs={'slug': self.file_update.slug}) |
136 | 138 | |
137 | - upload_file_update = open('/home/ailson/Pictures/update.png', 'rb') | |
139 | + upload_file_update = open( '/'.join([FILE_DIR, 'files/update.png']), 'rb') | |
138 | 140 | new_file = SimpleUploadedFile(upload_file_update.name, upload_file_update.read()) |
139 | 141 | data = { |
140 | 142 | 'name' : 'updated', | ... | ... |