Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

int & files in a form #18

Closed
FrancoisConstant opened this issue Aug 12, 2013 · 4 comments
Closed

int & files in a form #18

FrancoisConstant opened this issue Aug 12, 2013 · 4 comments

Comments

@FrancoisConstant
Copy link

Hi,

first of all, thanks a lot for that project, it does help a lot with writing great tests in Django.

I'm using the latest stable version of webtest (1.7.5)

I used to have a form like this with the test passing:
form = response.form
form['structure-total_number_of_employees'] = 50
...
response = form.submit()

Then when I've added a file to that and updated my code:
form = response.form
form['logo'] = ...
form['structure-total_number_of_employees'] = 50
...
response = form.submit()

It crashed with the following error:
virtual_env/dev_env/lib/python2.7/site-packages/webtest/app.py", line 382, in encode_multipart
body = b'\r\n'.join(lines)
TypeError: sequence item 12: expected string, int found

To get it to work, I've replaced 50 by "50":
form = response.form
form['logo'] = ...
form['structure-total_number_of_employees'] = "50"
...
response = form.submit()

I reckon that the encode multipart should be updated to handle integers.

@kharandziuk
Copy link
Contributor

try to use form['structure-total_number_of_employees'].value = 50

@FrancoisConstant
Copy link
Author

It's the same with .value

@kmike
Copy link
Member

kmike commented Aug 13, 2013

Hi @FrancoisConstant,

Could you please report this to https://github.com/Pylons/webtest ?

@FrancoisConstant
Copy link
Author

Yes of course will do now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants