Show More
@@ -4,7 +4,7 b' Authors : MinRK, gregcaporaso' | |||
|
4 | 4 | """ |
|
5 | 5 | |
|
6 | 6 | from os import walk |
|
7 |
from os.path import |
|
|
7 | from os.path import exists, isfile, splitext | |
|
8 | 8 | |
|
9 | 9 | |
|
10 | 10 | class YouTubeVideo(object): |
@@ -74,7 +74,7 b' class FileLink(object):' | |||
|
74 | 74 | self.result_html_suffix = result_html_suffix |
|
75 | 75 | |
|
76 | 76 | def _format_path(self): |
|
77 | fp = join(self.url_prefix,self.path) | |
|
77 | fp = '/'.join([self.url_prefix,self.path]) | |
|
78 | 78 | return ''.join([self.result_html_prefix, |
|
79 | 79 | self.link_str % (fp, self.path), |
|
80 | 80 | self.result_html_suffix]) |
@@ -44,12 +44,7 b' def test_existing_path_FileLink():' | |||
|
44 | 44 | tf = NamedTemporaryFile() |
|
45 | 45 | fl = display.FileLink(tf.name) |
|
46 | 46 | actual = fl._repr_html_() |
|
47 | # Note: this is a bit awkward since tf.name has to be a full path | |
|
48 | # for it to exist, but that won't happen in our applications. While | |
|
49 | # in practice "files/" would be prepended to the href path, os.join | |
|
50 | # doesn't do that if the second value is an absolute path. So, the | |
|
51 | # expected here is slightly different than what we get in practice. | |
|
52 | expected = "<a href='%s' target='_blank'>%s</a><br>" % (tf.name,tf.name) | |
|
47 | expected = "<a href='files/%s' target='_blank'>%s</a><br>" % (tf.name,tf.name) | |
|
53 | 48 | nt.assert_equal(actual,expected) |
|
54 | 49 | |
|
55 | 50 | #-------------------------- |
@@ -74,13 +69,8 b' def test_existing_path_FileLinks():' | |||
|
74 | 69 | actual = fl._repr_html_() |
|
75 | 70 | actual = actual.split('\n') |
|
76 | 71 | actual.sort() |
|
77 | # Note: this is a bit awkward since tf.name has to be a full path | |
|
78 | # for it to exist, but that won't happen in our applications. While | |
|
79 | # in practice "files/" would be prepended to the href path, os.join | |
|
80 | # doesn't do that if the second value is an absolute path. So, the | |
|
81 | # expected here is slightly different than what we get in practice. | |
|
82 | expected = ["<a href='%s' target='_blank'>%s</a><br>" % (tf2.name,tf2.name.split('/')[-1]), | |
|
83 | "<a href='%s' target='_blank'>%s</a><br>" % (tf1.name,tf1.name.split('/')[-1])] | |
|
72 | expected = ["<a href='files/%s' target='_blank'>%s</a><br>" % (tf2.name,tf2.name), | |
|
73 | "<a href='files/%s' target='_blank'>%s</a><br>" % (tf1.name,tf1.name)] | |
|
84 | 74 | expected.sort() |
|
85 | 75 | # We compare the sorted list of links here as that's more reliable |
|
86 | 76 | nt.assert_equal(actual,expected) |
@@ -103,10 +93,5 b' def test_existing_path_FileLinks():' | |||
|
103 | 93 | td = mkdtemp() |
|
104 | 94 | dl = display.DirectoryLink(td) |
|
105 | 95 | actual = dl._repr_html_() |
|
106 | # Note: this is a bit awkward since tf.name has to be a full path | |
|
107 | # for it to exist, but that won't happen in our applications. While | |
|
108 | # in practice "files/" would be prepended to the href path, os.join | |
|
109 | # doesn't do that if the second value is an absolute path. So, the | |
|
110 | # expected here is slightly different than what we get in practice. | |
|
111 | expected = "<a href='%s' target='_blank'>%s</a><br>" % (td,td) | |
|
96 | expected = "<a href='files/%s' target='_blank'>%s</a><br>" % (td,td) | |
|
112 | 97 | nt.assert_equal(actual,expected) |
General Comments 0
You need to be logged in to leave comments.
Login now