Use datasyncIdToken as poTokenIdentity
This commit is contained in:
1 parent
6a4a61b61f
commit
5e798f19de
12 files changed
+132
No files matched your search
@@ -0,0 +1,54 @@
|
||||
import "pkg:/components/Services/Innertube/OAuth.bs"
|
||||
|
||||
namespace Tests
|
||||
|
||||
@suite
|
||||
class InnertubeGetDatasyncIdTokenTests extends Rooibos.BaseTestSuite
|
||||
|
||||
@describe("Innertube.GetDatasyncIdToken")
|
||||
|
||||
@it("returns the datasyncIdToken verbatim (brand account, both halves)")
|
||||
function brandVerbatim()
|
||||
endpoint = {
|
||||
supportedTokens: [
|
||||
{ pageIdToken: { pageId: "100000000000000000001" } }
|
||||
{ datasyncIdToken: { datasyncIdToken: "100000000000000000001||200000000000000000002" } }
|
||||
]
|
||||
}
|
||||
m.assertEqual(Innertube.GetDatasyncIdToken(endpoint), "100000000000000000001||200000000000000000002")
|
||||
end function
|
||||
|
||||
@it("returns the default-account token verbatim, keeping the empty second half")
|
||||
function defaultEmptySecondHalf()
|
||||
endpoint = {
|
||||
supportedTokens: [
|
||||
{ datasyncIdToken: { datasyncIdToken: "300000000000000000003||" } }
|
||||
]
|
||||
}
|
||||
m.assertEqual(Innertube.GetDatasyncIdToken(endpoint), "300000000000000000003||")
|
||||
end function
|
||||
|
||||
@it("returns empty string when no datasyncIdToken is present")
|
||||
function noDatasyncToken()
|
||||
endpoint = {
|
||||
supportedTokens: [
|
||||
{ pageIdToken: { pageId: "400000000000000000004" } }
|
||||
{ accountStateToken: { obfuscatedGaiaId: "500000000000000000005" } }
|
||||
]
|
||||
}
|
||||
m.assertEqual(Innertube.GetDatasyncIdToken(endpoint), "")
|
||||
end function
|
||||
|
||||
@it("returns empty string for an invalid endpoint")
|
||||
function invalidEndpoint()
|
||||
m.assertEqual(Innertube.GetDatasyncIdToken(invalid), "")
|
||||
end function
|
||||
|
||||
@it("returns empty string for an endpoint without supportedTokens")
|
||||
function emptyEndpoint()
|
||||
m.assertEqual(Innertube.GetDatasyncIdToken({}), "")
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
Reference in new issue
Block a user