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,6 +9,9 @@ from files.models import TopicFile | ||
9 | from files.forms import FileForm, UpdateFileForm | 9 | from files.forms import FileForm, UpdateFileForm |
10 | from courses.models import CourseCategory, Course, Subject, Topic | 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 | class FileTestCase(TestCase): | 15 | class FileTestCase(TestCase): |
13 | 16 | ||
14 | def setUp(self): | 17 | def setUp(self): |
@@ -77,7 +80,6 @@ class FileTestCase(TestCase): | @@ -77,7 +80,6 @@ class FileTestCase(TestCase): | ||
77 | name = 'Topic Test', | 80 | name = 'Topic Test', |
78 | description = "description of the topic test file", | 81 | description = "description of the topic test file", |
79 | subject = self.subject, | 82 | subject = self.subject, |
80 | - owner = self.teacher, | ||
81 | ) | 83 | ) |
82 | self.topic.save() | 84 | self.topic.save() |
83 | 85 | ||
@@ -85,7 +87,7 @@ class FileTestCase(TestCase): | @@ -85,7 +87,7 @@ class FileTestCase(TestCase): | ||
85 | Manual upload file | 87 | Manual upload file |
86 | Change directory for a file in your computer and be happy... | 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 | self.file = SimpleUploadedFile(upload_file.name, upload_file.read()) | 91 | self.file = SimpleUploadedFile(upload_file.name, upload_file.read()) |
90 | 92 | ||
91 | def test_create_file_ok(self): | 93 | def test_create_file_ok(self): |
@@ -134,7 +136,7 @@ class FileTestCase(TestCase): | @@ -134,7 +136,7 @@ class FileTestCase(TestCase): | ||
134 | 136 | ||
135 | url = reverse('course:file:update_file',kwargs={'slug': self.file_update.slug}) | 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 | new_file = SimpleUploadedFile(upload_file_update.name, upload_file_update.read()) | 140 | new_file = SimpleUploadedFile(upload_file_update.name, upload_file_update.read()) |
139 | data = { | 141 | data = { |
140 | 'name' : 'updated', | 142 | 'name' : 'updated', |