Skip to content

Instantly share code, notes, and snippets.

@LeoHeo
Last active July 18, 2016 05:50
Show Gist options
  • Save LeoHeo/849ba4edef0d726a8ce4f65c3b68d888 to your computer and use it in GitHub Desktop.
Save LeoHeo/849ba4edef0d726a8ce4f65c3b68d888 to your computer and use it in GitHub Desktop.
def test_photo_job_create_should_return_201(self):
test_theme = 1
image = settings.PROJECT_ROOT_DIR + "/dist/media/test.png"
test_image = SimpleUploadedFile(
name="test.png",
content=open(image, "rb").read(),
content_type="image/png"
)
data = {
"theme": test_theme,
"image": [
test_image,
test_image,
test_image,
],
"content": [{
"content_1": "1111",
"content_2": "2222",
"content_3": "3333",
}],
}
response = self.client.post(
"/api/job-history/",
data=data,
format="multipart",
HTTP_AUTHORIZATION="JWT {token}".format(
token=self.token,
)
)
self.assertEquals(
201,
response.status_code,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment