|
a/Allura/allura/tests/functional/test_discuss.py |
|
b/Allura/allura/tests/functional/test_discuss.py |
|
... |
|
... |
123 |
if 'thread' in a['href'] ][0]
|
123 |
if 'thread' in a['href'] ][0]
|
124 |
thread = self.app.get(self.thread_link)
|
124 |
thread = self.app.get(self.thread_link)
|
125 |
for f in thread.html.findAll('form'):
|
125 |
for f in thread.html.findAll('form'):
|
126 |
if f.get('action', '').endswith('/post'):
|
126 |
if f.get('action', '').endswith('/post'):
|
127 |
break
|
127 |
break
|
128 |
self.post_form_link = f['action'].encode('utf-8')
|
128 |
self.post_form_link = f['action'].encode('utf-8')
|
129 |
params = dict()
|
129 |
params = dict()
|
130 |
inputs = f.findAll('input')
|
130 |
inputs = f.findAll('input')
|
131 |
for field in inputs:
|
131 |
for field in inputs:
|
132 |
if field.has_key('name'):
|
132 |
if field.has_key('name'):
|
133 |
params[field['name']] = field.has_key('value') and field['value'] or ''
|
133 |
params[field['name']] = field.has_key('value') and field['value'] or ''
|
|
... |
|
... |
146 |
alink = str(alink['href'])
|
146 |
alink = str(alink['href'])
|
147 |
break
|
147 |
break
|
148 |
else:
|
148 |
else:
|
149 |
assert False, 'attachment link not found'
|
149 |
assert False, 'attachment link not found'
|
150 |
r = self.app.get(alink)
|
150 |
r = self.app.get(alink)
|
|
|
151 |
assert r.content_disposition == 'attachment;filename="test.txt"', 'Attachments should force download'
|
151 |
r = self.app.post(self.post_link + 'attach',
|
152 |
r = self.app.post(self.post_link + 'attach',
|
152 |
upload_files=[('file_info', 'test.o12', 'HiThere!')])
|
153 |
upload_files=[('file_info', 'test.o12', 'HiThere!')])
|
153 |
r = self.app.post(alink, params=dict(delete='on'))
|
154 |
r = self.app.post(alink, params=dict(delete='on'))
|