Skip to content

Commit

Permalink
Merge pull request #75 from freedomofpress/fix_apiproxy
Browse files Browse the repository at this point in the history
Updates APIProxy class related tests
  • Loading branch information
redshiftzero authored Apr 24, 2019
2 parents 4b49dd5 + 3d22f00 commit 71ab1a6
Show file tree
Hide file tree
Showing 28 changed files with 149 additions and 63 deletions.
2 changes: 1 addition & 1 deletion data/setUp.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"{\"body\": \"{\\\"passphrase\\\": \\\"correct horse battery staple profanity oil chewy\\\", \\\"username\\\": \\\"journalist\\\"}\", \"method\": \"POST\", \"path_query\": \"api/v1/token\"}+1": "{\"body\": \"{\\n \\\"expiration\\\": \\\"2018-10-15T18:50:30.596706Z\\\", \\n \\\"token\\\": \\\"eyJhbGciOiJIUzI1NiIsImV4cCI6MTUzOTYyOTQzMCwiaWF0IjoxNTM5NjAwNjMwfQ.eyJpZCI6MX0.DxMon85hJuDUFMJdeWdICVQ7slqQHsIx2aNC2F88Ljk\\\"\\n}\\n\", \"headers\": {\"Server\": \"Werkzeug/0.14.1 Python/2.7.6\", \"Content-Type\": \"application/json\", \"Content-Length\": \"188\", \"Set-Cookie\": \"js=eyJleHBpcmVzIjp7IiBkIjoiTW9uLCAxNSBPY3QgMjAxOCAxMjo1MDozMCBHTVQifX0.DqYCdg.JSb0AxCyX5KKX8QeFaHOM32pJvM; HttpOnly; Path=/\", \"Vary\": \"Cookie\", \"Date\": \"Mon, 15 Oct 2018 10:50:30 GMT\"}, \"version\": \"0.1.1\", \"status\": 200}"}
{"{\"body\": \"{\\\"passphrase\\\": \\\"correct horse battery staple profanity oil chewy\\\", \\\"username\\\": \\\"journalist\\\"}\", \"method\": \"POST\", \"path_query\": \"api/v1/token\"}+1": "{\"version\": \"0.1.1\", \"body\": \"{\\n \\\"expiration\\\": \\\"2019-04-19T16:27:11.266887Z\\\", \\n \\\"journalist_uuid\\\": \\\"27ecc916-61db-4674-b7c2-a26ffb14936c\\\", \\n \\\"token\\\": \\\"eyJhbGciOiJIUzI1NiIsImV4cCI6MTU1NTY5MTIzMSwiaWF0IjoxNTU1NjYyNDMxfQ.eyJpZCI6MX0.gYmLbZ2LV27YOebs3yKxcQjTinaXXFRyprsr05va3aM\\\"\\n}\\n\", \"status\": 200, \"headers\": {\"Content-Type\": \"application/json\", \"Server\": \"Werkzeug/0.14.1 Python/2.7.12\", \"Content-Length\": \"250\", \"Date\": \"Fri, 19 Apr 2019 08:27:11 GMT\"}}"}
2 changes: 1 addition & 1 deletion data/test_delete_reply.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/test_delete_source.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/test_delete_source_from_string.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/test_delete_submission.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/test_delete_submission_from_string.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/test_download_reply.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"{\"headers\": \"{\\\"Accept\\\": \\\"application/json\\\", \\\"Content-Type\\\": \\\"application/json\\\"}\", \"method\": \"GET\", \"path_query\": \"api/v1/replies\"}+1": "{\"version\": \"0.1.1\", \"body\": \"{\\n \\\"replies\\\": [\\n {\\n \\\"filename\\\": \\\"3-starry-eyed_shaping-reply.gpg\\\", \\n \\\"is_deleted_by_source\\\": false, \\n \\\"journalist_username\\\": \\\"journalist\\\", \\n \\\"journalist_uuid\\\": \\\"bc175c3f-7559-46a6-b26b-d7c88ed5b136\\\", \\n \\\"reply_url\\\": \\\"/api/v1/sources/5f891a3a-0b2a-40b7-9c9a-49c4ca7252b2/replies/eb750345-5c40-4ced-acf2-6f8b27298c68\\\", \\n \\\"size\\\": 1116, \\n \\\"source_url\\\": \\\"/api/v1/sources/5f891a3a-0b2a-40b7-9c9a-49c4ca7252b2\\\", \\n \\\"uuid\\\": \\\"eb750345-5c40-4ced-acf2-6f8b27298c68\\\"\\n }, \\n {\\n \\\"filename\\\": \\\"4-starry-eyed_shaping-reply.gpg\\\", \\n \\\"is_deleted_by_source\\\": false, \\n \\\"journalist_username\\\": \\\"journalist\\\", \\n \\\"journalist_uuid\\\": \\\"bc175c3f-7559-46a6-b26b-d7c88ed5b136\\\", \\n \\\"reply_url\\\": \\\"/api/v1/sources/5f891a3a-0b2a-40b7-9c9a-49c4ca7252b2/replies/3a1ae2ec-2e73-447c-be9f-cfcebdb4e38e\\\", \\n \\\"size\\\": 1116, \\n \\\"source_url\\\": \\\"/api/v1/sources/5f891a3a-0b2a-40b7-9c9a-49c4ca7252b2\\\", \\n \\\"uuid\\\": \\\"3a1ae2ec-2e73-447c-be9f-cfcebdb4e38e\\\"\\n }, \\n {\\n \\\"filename\\\": \\\"3-datable_syncopation-reply.gpg\\\", \\n \\\"is_deleted_by_source\\\": false, \\n \\\"journalist_username\\\": \\\"journalist\\\", \\n \\\"journalist_uuid\\\": \\\"bc175c3f-7559-46a6-b26b-d7c88ed5b136\\\", \\n \\\"reply_url\\\": \\\"/api/v1/sources/e94ad028-52d4-4b48-bd8a-61e886aac9dd/replies/a884c037-320d-40d0-9764-0af4241eb35b\\\", \\n \\\"size\\\": 1116, \\n \\\"source_url\\\": \\\"/api/v1/sources/e94ad028-52d4-4b48-bd8a-61e886aac9dd\\\", \\n \\\"uuid\\\": \\\"a884c037-320d-40d0-9764-0af4241eb35b\\\"\\n }, \\n {\\n \\\"filename\\\": \\\"4-datable_syncopation-reply.gpg\\\", \\n \\\"is_deleted_by_source\\\": false, \\n \\\"journalist_username\\\": \\\"journalist\\\", \\n \\\"journalist_uuid\\\": \\\"bc175c3f-7559-46a6-b26b-d7c88ed5b136\\\", \\n \\\"reply_url\\\": \\\"/api/v1/sources/e94ad028-52d4-4b48-bd8a-61e886aac9dd/replies/7c8945b4-7f59-413d-994d-37a85da429b8\\\", \\n \\\"size\\\": 1116, \\n \\\"source_url\\\": \\\"/api/v1/sources/e94ad028-52d4-4b48-bd8a-61e886aac9dd\\\", \\n \\\"uuid\\\": \\\"7c8945b4-7f59-413d-994d-37a85da429b8\\\"\\n }\\n ]\\n}\\n\", \"headers\": {\"Set-Cookie\": \"js=eyJleHBpcmVzIjp7IiBkIjoiTW9uLCAxNSBPY3QgMjAxOCAxMjo0MTowMSBHTVQifX0.DqYAPQ.Fh6DlFTKUWOGxS1xm6BjCiRyb4Y; HttpOnly; Path=/\", \"Content-Length\": \"1973\", \"Date\": \"Mon, 15 Oct 2018 10:41:01 GMT\", \"Content-Type\": \"application/json\", \"Vary\": \"Cookie\", \"Server\": \"Werkzeug/0.14.1 Python/2.7.6\"}, \"status\": 200}", "{\"headers\": \"{\\\"Accept\\\": \\\"application/json\\\", \\\"Content-Type\\\": \\\"application/json\\\"}\", \"method\": \"GET\", \"path_query\": \"api/v1/sources/5f891a3a-0b2a-40b7-9c9a-49c4ca7252b2/replies/eb750345-5c40-4ced-acf2-6f8b27298c68/download\"}+2": "{\"body\": \"{\\\"filename\\\": \\\"80eed7a8-9fd6-4f95-baa4-fc740a7b1b5b\\\"}\", \"version\": \"0.1.1\", \"headers\": {\"Set-Cookie\": \"js=eyJleHBpcmVzIjp7IiBkIjoiTW9uLCAxNSBPY3QgMjAxOCAxMjo0MTowMiBHTVQifX0.DqYAPg.Opm78odeqggdZxWWC4NbqiiatMM; HttpOnly; Path=/\", \"Cache-Control\": \"public, max-age=43200\", \"Server\": \"Werkzeug/0.14.1 Python/2.7.6\", \"Last-Modified\": \"Mon, 15 Oct 2018 10:40:29 GMT\", \"Content-Disposition\": \"attachment; filename=3-starry-eyed_shaping-reply.gpg\", \"Content-Type\": \"application/json\", \"Vary\": \"Cookie\", \"Etag\": \"\\\"sha256:c8a250d083f37d2ea184dc37b84b887af5a9e1c09f260049a8668ad91e9e05cd\\\"\", \"X-Origin-Content-Type\": \"application/json\", \"Expires\": \"Mon, 15 Oct 2018 22:41:02 GMT\", \"Date\": \"Mon, 15 Oct 2018 10:41:02 GMT\", \"Content-Length\": \"1116\"}, \"status\": 200}"}
{"{\"body\": \"{\\\"passphrase\\\": \\\"correct horse battery staple profanity oil chewy\\\", \\\"username\\\": \\\"journalist\\\"}\", \"method\": \"POST\", \"path_query\": \"api/v1/token\"}+1": "{\"version\": \"0.1.1\", \"body\": \"{\\n \\\"expiration\\\": \\\"2019-04-19T16:27:11.266887Z\\\", \\n \\\"journalist_uuid\\\": \\\"27ecc916-61db-4674-b7c2-a26ffb14936c\\\", \\n \\\"token\\\": \\\"eyJhbGciOiJIUzI1NiIsImV4cCI6MTU1NTY5MTIzMSwiaWF0IjoxNTU1NjYyNDMxfQ.eyJpZCI6MX0.gYmLbZ2LV27YOebs3yKxcQjTinaXXFRyprsr05va3aM\\\"\\n}\\n\", \"status\": 200, \"headers\": {\"Content-Type\": \"application/json\", \"Server\": \"Werkzeug/0.14.1 Python/2.7.12\", \"Content-Length\": \"250\", \"Date\": \"Fri, 19 Apr 2019 08:27:11 GMT\"}}", "{\"headers\": \"{\\\"Accept\\\": \\\"application/json\\\", \\\"Content-Type\\\": \\\"application/json\\\"}\", \"method\": \"GET\", \"path_query\": \"api/v1/sources/52235a5e-b62d-4ded-b6ef-c3233834cf2d/replies/9e9b5324-4f49-42c4-b705-9bb061eacd45/download\"}+2": "{\"version\": \"0.1.1\", \"body\": \"{\\\"filename\\\": \\\"16325bd9-6c6b-46fb-89a7-6bf710fdb18c\\\"}\", \"headers\": {\"Content-Disposition\": \"attachment; filename=3-acknowledged_amalgam-reply.gpg\", \"Content-Length\": \"1134\", \"Etag\": \"\\\"sha256:e2f8e703863589cdb3c4bccec7a11eb9eccabe83189072caf3108b38129f316d\\\"\", \"Last-Modified\": \"Thu, 18 Apr 2019 18:25:55 GMT\", \"X-Origin-Content-Type\": \"application/json\", \"Date\": \"Fri, 19 Apr 2019 08:27:28 GMT\", \"Cache-Control\": \"public, max-age=43200\", \"Expires\": \"Fri, 19 Apr 2019 20:27:28 GMT\", \"Content-Type\": \"application/json\", \"Server\": \"Werkzeug/0.14.1 Python/2.7.12\"}, \"status\": 200}", "{\"headers\": \"{\\\"Accept\\\": \\\"application/json\\\", \\\"Content-Type\\\": \\\"application/json\\\"}\", \"method\": \"GET\", \"path_query\": \"api/v1/replies\"}+1": "{\"headers\": {\"Date\": \"Fri, 19 Apr 2019 08:27:27 GMT\", \"Content-Length\": \"2947\", \"Content-Type\": \"application/json\", \"Server\": \"Werkzeug/0.14.1 Python/2.7.12\"}, \"body\": \"{\\n \\\"replies\\\": [\\n {\\n \\\"filename\\\": \\\"3-acknowledged_amalgam-reply.gpg\\\", \\n \\\"is_deleted_by_source\\\": false, \\n \\\"journalist_username\\\": \\\"journalist\\\", \\n \\\"journalist_uuid\\\": \\\"27ecc916-61db-4674-b7c2-a26ffb14936c\\\", \\n \\\"reply_url\\\": \\\"/api/v1/sources/52235a5e-b62d-4ded-b6ef-c3233834cf2d/replies/9e9b5324-4f49-42c4-b705-9bb061eacd45\\\", \\n \\\"size\\\": 1134, \\n \\\"source_url\\\": \\\"/api/v1/sources/52235a5e-b62d-4ded-b6ef-c3233834cf2d\\\", \\n \\\"uuid\\\": \\\"9e9b5324-4f49-42c4-b705-9bb061eacd45\\\"\\n }, \\n {\\n \\\"filename\\\": \\\"4-acknowledged_amalgam-reply.gpg\\\", \\n \\\"is_deleted_by_source\\\": false, \\n \\\"journalist_username\\\": \\\"journalist\\\", \\n \\\"journalist_uuid\\\": \\\"27ecc916-61db-4674-b7c2-a26ffb14936c\\\", \\n \\\"reply_url\\\": \\\"/api/v1/sources/52235a5e-b62d-4ded-b6ef-c3233834cf2d/replies/1bafa0ca-6801-4a36-b4db-2efc04920ac9\\\", \\n \\\"size\\\": 1135, \\n \\\"source_url\\\": \\\"/api/v1/sources/52235a5e-b62d-4ded-b6ef-c3233834cf2d\\\", \\n \\\"uuid\\\": \\\"1bafa0ca-6801-4a36-b4db-2efc04920ac9\\\"\\n }, \\n {\\n \\\"filename\\\": \\\"3-irresolute_legatee-reply.gpg\\\", \\n \\\"is_deleted_by_source\\\": false, \\n \\\"journalist_username\\\": \\\"journalist\\\", \\n \\\"journalist_uuid\\\": \\\"27ecc916-61db-4674-b7c2-a26ffb14936c\\\", \\n \\\"reply_url\\\": \\\"/api/v1/sources/91583768-487a-4986-88c0-e8140d860544/replies/8aad6f20-33cf-4df9-949e-8f57e4709416\\\", \\n \\\"size\\\": 1135, \\n \\\"source_url\\\": \\\"/api/v1/sources/91583768-487a-4986-88c0-e8140d860544\\\", \\n \\\"uuid\\\": \\\"8aad6f20-33cf-4df9-949e-8f57e4709416\\\"\\n }, \\n {\\n \\\"filename\\\": \\\"4-irresolute_legatee-reply.gpg\\\", \\n \\\"is_deleted_by_source\\\": false, \\n \\\"journalist_username\\\": \\\"journalist\\\", \\n \\\"journalist_uuid\\\": \\\"27ecc916-61db-4674-b7c2-a26ffb14936c\\\", \\n \\\"reply_url\\\": \\\"/api/v1/sources/91583768-487a-4986-88c0-e8140d860544/replies/9775caa4-267a-4635-a311-b1099cd48842\\\", \\n \\\"size\\\": 1135, \\n \\\"source_url\\\": \\\"/api/v1/sources/91583768-487a-4986-88c0-e8140d860544\\\", \\n \\\"uuid\\\": \\\"9775caa4-267a-4635-a311-b1099cd48842\\\"\\n }, \\n {\\n \\\"filename\\\": \\\"3-unashamed_mutineer-reply.gpg\\\", \\n \\\"is_deleted_by_source\\\": false, \\n \\\"journalist_username\\\": \\\"journalist\\\", \\n \\\"journalist_uuid\\\": \\\"27ecc916-61db-4674-b7c2-a26ffb14936c\\\", \\n \\\"reply_url\\\": \\\"/api/v1/sources/648a793b-f97b-4133-a0df-42baae61ca46/replies/1e1b4002-d758-4556-8cf8-d5780bf4f842\\\", \\n \\\"size\\\": 1135, \\n \\\"source_url\\\": \\\"/api/v1/sources/648a793b-f97b-4133-a0df-42baae61ca46\\\", \\n \\\"uuid\\\": \\\"1e1b4002-d758-4556-8cf8-d5780bf4f842\\\"\\n }, \\n {\\n \\\"filename\\\": \\\"4-unashamed_mutineer-reply.gpg\\\", \\n \\\"is_deleted_by_source\\\": false, \\n \\\"journalist_username\\\": \\\"journalist\\\", \\n \\\"journalist_uuid\\\": \\\"27ecc916-61db-4674-b7c2-a26ffb14936c\\\", \\n \\\"reply_url\\\": \\\"/api/v1/sources/648a793b-f97b-4133-a0df-42baae61ca46/replies/2229e79d-319e-4124-9330-bb9288b6b38f\\\", \\n \\\"size\\\": 1135, \\n \\\"source_url\\\": \\\"/api/v1/sources/648a793b-f97b-4133-a0df-42baae61ca46\\\", \\n \\\"uuid\\\": \\\"2229e79d-319e-4124-9330-bb9288b6b38f\\\"\\n }\\n ]\\n}\\n\", \"version\": \"0.1.1\", \"status\": 200}"}
Loading

0 comments on commit 71ab1a6

Please sign in to comment.