def test_file(self):
        args = {
            'fieldname': 'file',
            'filename' : 'test.json',
            'data'     : {'body': 'test'},
            'headers'  : {'X-Requested-With': 'XMLHttpRequest'}
        }

        response = HttpClient.file('http://curtaincall.weblike.jp/prog/php/test-api/file.php', **args)

        data = json.loads(response.text)

        self.assertTrue(data['result'])
        self.assertEqual(data['messages'], ['Success'])
예제 #2
0
import sys
import json

sys.path.append('../src')

from http_client import HttpClient

args = {
    'fieldname': 'file',
    'filename' : 'test.json',
    'data'     : {'body': 'test'},
    'headers'  : {'X-Requested-With': 'XMLHttpRequest'}
}

response = HttpClient.file('http://curtaincall.weblike.jp/prog/php/test-api/file.php', **args)

data = json.loads(response.text)

print(data['result'])
print(data['messages'])