Skip to content
Myr

Merge pull request #670 from piotr-dobrogost/#669

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixes issue #669

authored by Kenneth Reitz · committed by Kenneth Reitz · parents f413d0e, 8d75cdf · Browse files · 1 file+6 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−2 removed

  • tests:+6 added−2 removed

1 file+6 added−2 removed

modified:tests/test_requests.py+6 added-2 removed
465 unmodified lines
466467 def test_file_post_data(self):468469 filecontent = b"fooaowpeufbarasjhf"470 testfile = tempfile.NamedTemporaryFile()470 testfile = tempfile.NamedTemporaryFile(delete=False)471 testfile.write(filecontent)472 testfile.flush()473 testfile.close()474475 for service in SERVICES:476477 data = open(testfile.name, "rb")476 r = post(service('post'), data=open(testfile.name, "rb"),478 r = post(service('post'), data=data,479 headers={"content-type": "application/octet-stream"})480481 data.close()482 self.assertEqual(r.status_code, 200)483 self.assertEqual(r.headers['content-type'], 'application/json')484 self.assertEqual(r.url, service('post'))485486 rbody = json.loads(r.text)487 assert rbody.get('form') in (None, {})488 self.assertEqual(rbody.get('data'), filecontent.decode('ascii'))489 os.remove(testfile.name)490491 def test_urlencoded_post_querystring(self):492493 for service in SERVICES:
456 unmodified lines