| | 204 | |
|---|
| | 205 | Test for the behavior of _has_changed for FileInput. The value of data will |
|---|
| | 206 | more than likely come from request.FILES. The value of initial data will |
|---|
| | 207 | likely be a filename stored in the database. Since its value is of no use to |
|---|
| | 208 | a FileInput it is ignored. |
|---|
| | 209 | |
|---|
| | 210 | >>> w = FileInput() |
|---|
| | 211 | |
|---|
| | 212 | # No file was uploaded and no initial data. |
|---|
| | 213 | >>> w._has_changed(u'', None) |
|---|
| | 214 | False |
|---|
| | 215 | |
|---|
| | 216 | # A file was uploaded and no initial data. |
|---|
| | 217 | >>> w._has_changed(u'', {'filename': 'resume.txt', 'content': 'My resume'}) |
|---|
| | 218 | True |
|---|
| | 219 | |
|---|
| | 220 | # A file was not uploaded, but there is initial data |
|---|
| | 221 | >>> w._has_changed(u'resume.txt', None) |
|---|
| | 222 | False |
|---|
| | 223 | |
|---|
| | 224 | # A file was uploaded and there is initial data (file identity is not dealt |
|---|
| | 225 | # with here) |
|---|
| | 226 | >>> w._has_changed('resume.txt', {'filename': 'resume.txt', 'content': 'My resume'}) |
|---|
| | 227 | True |
|---|