I am trying to automate the action of uploading a csv document to a file storage website.
I am attempting to do this test as a backend API test.
I have the file stored in my directory, and i want to send it as a parameter along with a json endpoint.
I am currently using python functions and doing the main test in robot framework.
Can anyone help me out?
def uploadFileContent(self,filename):
path = self.makeurl("XXX.json")
name = self.uploads_path+filename
sys.stderr.write('\n> Filename: ' + name + '\n')
files = {filename: open(name, 'rb'), "name": "bulk_users_csv"}
response = requests.post(path, files = files, cookies=self.cookies)
print response.text
self.status_code_should_be(201)
return response