1143 |
1143 |
assert formdata.evolution[-1].display_parts()[-1] == '<div><p>hello</p></div>'
|
1144 |
1144 |
|
1145 |
1145 |
|
1146 |
|
def test_register_comment_attachment(pub):
|
1147 |
|
pub.substitutions.feed(MockSubstitutionVariables())
|
|
1146 |
def test_register_comment_attachment(two_pubs):
|
|
1147 |
if two_pubs.is_using_postgresql():
|
|
1148 |
two_pubs.loggederror_class.wipe()
|
|
1149 |
two_pubs.substitutions.feed(MockSubstitutionVariables())
|
1148 |
1150 |
|
1149 |
1151 |
formdef = FormDef()
|
1150 |
1152 |
formdef.name = 'baz'
|
... | ... | |
1174 |
1176 |
|
1175 |
1177 |
item.comment = '{{ attachments.testfile.url }}'
|
1176 |
1178 |
|
1177 |
|
pub.substitutions.feed(formdata)
|
|
1179 |
two_pubs.substitutions.feed(formdata)
|
1178 |
1180 |
item.perform(formdata)
|
1179 |
1181 |
url1 = formdata.evolution[-1].parts[-1].content
|
|
1182 |
if two_pubs.is_using_postgresql():
|
|
1183 |
assert two_pubs.loggederror_class.count() == 1
|
|
1184 |
error = two_pubs.loggederror_class.select()[0]
|
|
1185 |
assert error.kind == 'deprecated_usage'
|
|
1186 |
assert error.occurences_count == 1
|
1180 |
1187 |
|
1181 |
|
pub.substitutions.feed(formdata)
|
|
1188 |
two_pubs.substitutions.feed(formdata)
|
1182 |
1189 |
item.comment = '{{ form_attachments.testfile.url }}'
|
1183 |
1190 |
item.perform(formdata)
|
1184 |
1191 |
url2 = formdata.evolution[-1].parts[-1].content
|
|
1192 |
if two_pubs.is_using_postgresql():
|
|
1193 |
assert two_pubs.loggederror_class.count() == 1
|
|
1194 |
error = two_pubs.loggederror_class.select()[0]
|
|
1195 |
assert error.kind == 'deprecated_usage'
|
|
1196 |
assert error.occurences_count == 1
|
1185 |
1197 |
|
1186 |
1198 |
assert len(os.listdir(os.path.join(get_publisher().app_dir, 'attachments'))) == 1
|
1187 |
1199 |
for subdir in os.listdir(os.path.join(get_publisher().app_dir, 'attachments')):
|
... | ... | |
1204 |
1216 |
item.condition = {'type': 'django', 'value': 'form_attachments.missing'}
|
1205 |
1217 |
assert item.check_condition(formdata) is False
|
1206 |
1218 |
|
1207 |
|
pub.substitutions.feed(formdata)
|
|
1219 |
two_pubs.substitutions.feed(formdata)
|
1208 |
1220 |
item.comment = '[attachments.testfile.url]'
|
1209 |
1221 |
item.perform(formdata)
|
1210 |
1222 |
url3 = formdata.evolution[-1].parts[-1].content
|
1211 |
|
pub.substitutions.feed(formdata)
|
|
1223 |
if two_pubs.is_using_postgresql():
|
|
1224 |
assert two_pubs.loggederror_class.count() == 1
|
|
1225 |
error = two_pubs.loggederror_class.select()[0]
|
|
1226 |
assert error.kind == 'deprecated_usage'
|
|
1227 |
assert error.occurences_count == 2
|
|
1228 |
two_pubs.substitutions.feed(formdata)
|
1212 |
1229 |
item.comment = '[form_attachments.testfile.url]'
|
1213 |
1230 |
item.perform(formdata)
|
1214 |
1231 |
url4 = formdata.evolution[-1].parts[-1].content
|
1215 |
1232 |
assert url3 == url4
|
|
1233 |
if two_pubs.is_using_postgresql():
|
|
1234 |
assert two_pubs.loggederror_class.count() == 1
|
|
1235 |
error = two_pubs.loggederror_class.select()[0]
|
|
1236 |
assert error.kind == 'deprecated_usage'
|
|
1237 |
assert error.occurences_count == 2
|
1216 |
1238 |
|
1217 |
1239 |
|
1218 |
1240 |
def test_register_comment_with_attachment_file(pub):
|
... | ... | |
2028 |
2050 |
item.url = 'http://remote.example.net'
|
2029 |
2051 |
item.request_signature_key = '{{ doesntexist }}'
|
2030 |
2052 |
item.perform(formdata)
|
2031 |
|
assert not 'signature=' in http_requests.get_last('url')
|
|
2053 |
assert 'signature=' not in http_requests.get_last('url')
|
2032 |
2054 |
|
2033 |
2055 |
item = WebserviceCallStatusItem()
|
2034 |
2056 |
item.url = 'http://remote.example.net'
|
2035 |
2057 |
item.request_signature_key = '{{ empty }}'
|
2036 |
2058 |
item.perform(formdata)
|
2037 |
|
assert not 'signature=' in http_requests.get_last('url')
|
|
2059 |
assert 'signature=' not in http_requests.get_last('url')
|
2038 |
2060 |
|
2039 |
2061 |
item = WebserviceCallStatusItem()
|
2040 |
2062 |
item.url = 'http://remote.example.net'
|
2041 |
2063 |
item.request_signature_key = '[empty]'
|
2042 |
2064 |
item.perform(formdata)
|
2043 |
|
assert not 'signature=' in http_requests.get_last('url')
|
|
2065 |
assert 'signature=' not in http_requests.get_last('url')
|
2044 |
2066 |
|
2045 |
2067 |
item = WebserviceCallStatusItem()
|
2046 |
2068 |
item.url = 'http://remote.example.net'
|