Skip to content
This repository has been archived by the owner on Jan 7, 2024. It is now read-only.

Updates tests and data file for first and last name #92

Merged
merged 1 commit into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions data/test-get-current-user.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,21 @@ interactions:
headers:
Accept: [application/json]
Accept-Encoding: ['gzip, deflate']
Authorization: [Token eyJhbGciOiJIUzI1NiIsImV4cCI6MTU0MDI3NjkxOCwiaWF0IjoxNTQwMjQ4MTE4fQ.eyJpZCI6MX0.fygpQy3CxB1ulUWLFz2UdrtcBKHz-fk5gyRxbcSY720]
Authorization: [Token eyJhbGciOiJIUzI1NiIsImV4cCI6MTU2MDQ2OTgwMywiaWF0IjoxNTYwNDQxMDAzfQ.eyJpZCI6MX0.3iyw2GfggT1pOe-Offan7HKYo86L4JpmoTgaUuy9Sm0]
Connection: [keep-alive]
Content-Type: [application/json]
User-Agent: [python-requests/2.20.0]
method: GET
uri: http://127.0.0.1:8081/api/v1/user
response:
body: {string: "{\n \"is_admin\": true, \n \"last_login\": \"2018-10-22T23:00:06.845751Z\",
\n \"username\": \"journalist\", \n \"uuid\": \"16db39ec-0f92-4299-a15d-f6053b3d52a7\"\n}\n"}
body: {string: "{\n \"first_name\": null, \n \"is_admin\": true, \n \"last_login\"\
: \"2019-06-13T15:50:03.679186Z\", \n \"last_name\": null, \n \"username\"\
: \"journalist\", \n \"uuid\": \"e56c08ab-811d-4fdb-ad26-87da555b6858\"\n\
}\n"}
headers:
Content-Length: ['151']
Content-Length: ['196']
Content-Type: [application/json]
Date: ['Mon, 22 Oct 2018 23:00:12 GMT']
Server: [Werkzeug/0.14.1 Python/2.7.6]
Set-Cookie: [js=eyJleHBpcmVzIjp7IiBkIjoiVHVlLCAyMyBPY3QgMjAxOCAwMTowMDoxMiBHTVQifX0.Dq_n_A.ati4ypL2flydeIpO5E3gW0YX364;
HttpOnly; Path=/]
Vary: [Cookie]
Date: ['Thu, 13 Jun 2019 15:50:03 GMT']
Server: [Werkzeug/0.14.1 Python/2.7.12]
status: {code: 200, message: OK}
version: 1
2 changes: 1 addition & 1 deletion data/test_get_current_user.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": "{\"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/user\"}+1": "{\"version\": \"0.1.1\", \"status\": 200, \"headers\": {\"Content-Type\": \"application/json\", \"Server\": \"Werkzeug/0.14.1 Python/2.7.12\", \"Date\": \"Fri, 19 Apr 2019 08:27:39 GMT\", \"Content-Length\": \"151\"}, \"body\": \"{\\n \\\"is_admin\\\": true, \\n \\\"last_login\\\": \\\"2019-04-19T08:27:11.268953Z\\\", \\n \\\"username\\\": \\\"journalist\\\", \\n \\\"uuid\\\": \\\"27ecc916-61db-4674-b7c2-a26ffb14936c\\\"\\n}\\n\"}"}
{"{\"headers\": \"{\\\"Accept\\\": \\\"application/json\\\", \\\"Content-Type\\\": \\\"application/json\\\"}\", \"method\": \"GET\", \"path_query\": \"api/v1/user\"}+1": "{\"headers\": {\"Server\": \"Werkzeug/0.14.1 Python/2.7.12\", \"Date\": \"Thu, 13 Jun 2019 16:21:24 GMT\", \"Content-Type\": \"application/json\", \"Content-Length\": \"196\"}, \"version\": \"0.1.1\", \"body\": \"{\\n \\\"first_name\\\": null, \\n \\\"is_admin\\\": true, \\n \\\"last_login\\\": \\\"2019-06-13T16:21:23.990588Z\\\", \\n \\\"last_name\\\": null, \\n \\\"username\\\": \\\"journalist\\\", \\n \\\"uuid\\\": \\\"e56c08ab-811d-4fdb-ad26-87da555b6858\\\"\\n}\\n\", \"status\": 200}"}
2 changes: 2 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ def test_get_current_user(self):
user = self.api.get_current_user()
self.assertTrue(user["is_admin"])
self.assertEqual(user["username"], "journalist")
self.assertTrue("first_name" in user)
self.assertTrue("last_name" in user)

@vcr.use_cassette("data/test-error-unencrypted-reply.yml")
def test_error_unencrypted_reply(self):
Expand Down
2 changes: 2 additions & 0 deletions tests/test_apiproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def test_get_current_user(self):
user = self.api.get_current_user()
self.assertTrue(user["is_admin"])
self.assertEqual(user["username"], "journalist")
self.assertTrue("first_name" in user)
self.assertTrue("last_name" in user)

@dastollervey_datasaver
def test_error_unencrypted_reply(self):
Expand Down