Skip to content
This repository was archived by the owner on Jun 28, 2022. It is now read-only.

Commit 8f08308

Browse files
committed
Check authCache for expected entry
1 parent 739c1ff commit 8f08308

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/test/scala/GitHubOauthServletTests.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.udacity.github.oauth.test
22

3+
import com.udacity.github.oauth.GitHubUser
4+
import com.udacity.github.oauth.AuthKey
35
import com.udacity.github.oauth.GitHubOauthServlet
46
import org.eclipse.jetty.server.Server
57
import org.eclipse.jetty.server.ServerConnector
@@ -125,6 +127,14 @@ class GitHubOauthServletTests extends FunSuite with BeforeAndAfterAll {
125127
case Response(status, headers, body) =>
126128
assert(302 === status)
127129
assert(headers.get("Location") === Some(continueUrl))
130+
val userO: Option[GitHubUser] =
131+
for {
132+
setCookie <- headers.get("Set-Cookie")
133+
values <- setCookie.split("=").lift(1)
134+
value <- values.split(";").lift(0)
135+
user <- GitHubOauthServlet.get(AuthKey(value))
136+
} yield user
137+
assert(Some(GitHubUser("Bob")) === userO)
128138
}
129139
}
130140

0 commit comments

Comments
 (0)