mirror of
https://github.com/LukeHagar/plex-api-oauth.git
synced 2025-12-10 04:20:51 +00:00
RFC Compat testing
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "plex-api-oauth",
|
"name": "plex-api-oauth",
|
||||||
"version": "1.1.10",
|
"version": "1.1.46",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "plex-api-oauth",
|
"name": "plex-api-oauth",
|
||||||
"version": "1.1.10",
|
"version": "1.1.46",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^0.27.2",
|
"axios": "^0.27.2",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "plex-api-oauth",
|
"name": "plex-api-oauth",
|
||||||
"version": "1.1.46",
|
"version": "1.1.58",
|
||||||
"description": "An NPM Module designed to make Plex Media Server and plex.tv API calls easier to implement in JavaScript and React projects",
|
"description": "An NPM Module designed to make Plex Media Server and plex.tv API calls easier to implement in JavaScript and React projects",
|
||||||
"main": "./src/index.js",
|
"main": "./src/index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
23
src/index.js
23
src/index.js
@@ -1 +1,22 @@
|
|||||||
export { PlexAPIOAuth } from "./PlexAPIOAuth/PlexAPIOAuth.js";
|
export {
|
||||||
|
GeneratePlexClientInformation,
|
||||||
|
CreatePlexClientInformation,
|
||||||
|
PlexLogin,
|
||||||
|
GetPlexUserData,
|
||||||
|
GetPlexServers,
|
||||||
|
GetPlexMovies,
|
||||||
|
GetPlexShows,
|
||||||
|
GetPlexSeasons,
|
||||||
|
GetPlexEpisodes,
|
||||||
|
GetPlexMovieLibraries,
|
||||||
|
GetPlexMusicLibraries,
|
||||||
|
GetPlexTVShowLibraries,
|
||||||
|
GetPlexArtists,
|
||||||
|
GetPlexAlbums,
|
||||||
|
GetPlexSongs,
|
||||||
|
GetPlexLibraries,
|
||||||
|
GetPlexDevices,
|
||||||
|
GetLibraryPages,
|
||||||
|
LoadPlexSession,
|
||||||
|
SavePlexSession,
|
||||||
|
} from "./PlexAPIOAuth/PlexAPIOAuth.js";
|
||||||
|
|||||||
@@ -1,177 +1,194 @@
|
|||||||
import { PlexAPIOAuth } from "../src/index.js";
|
|
||||||
import { strict as assert } from "assert";
|
import { strict as assert } from "assert";
|
||||||
|
import {
|
||||||
|
CreatePlexClientInformation,
|
||||||
|
GeneratePlexClientInformation,
|
||||||
|
PlexLogin,
|
||||||
|
GetPlexUserData,
|
||||||
|
} from "../src/index.js";
|
||||||
|
import React, { useState } from "React";
|
||||||
|
|
||||||
describe("Unit Tests", function () {
|
function UnitTests() {
|
||||||
let PlexSession = new PlexAPIOAuth();
|
const [plexClientInformation, setPlexClientInformation] = useState();
|
||||||
let emptyArray = [];
|
const [plexTVAuthToken, setPlexTVAuthToken] = useState();
|
||||||
it("Generate ClientId", function () {
|
const [plexTVUserData, setPlexUserData] = useState();
|
||||||
PlexSession.GenerateClientId();
|
const [plexServers, setPlexServers] = useState();
|
||||||
assert.notEqual(PlexSession.clientId, null);
|
describe("Unit Tests", function () {
|
||||||
assert.notEqual(PlexSession.clientId, undefined);
|
let emptyArray = [];
|
||||||
// console.log("Plex Session");
|
it("Generate ClientId", function () {
|
||||||
// console.log(PlexSession);
|
setPlexClientInformation(CreatePlexClientInformation());
|
||||||
});
|
assert.notEqual(plexClientInformation, null);
|
||||||
it("Login", async function () {
|
assert.notEqual(plexClientInformation, undefined);
|
||||||
this.timeout(10000);
|
console.log("Plex Session");
|
||||||
let response = await PlexSession.PlexLogin();
|
console.log(plexClientInformation);
|
||||||
assert.notEqual(PlexSession.plexTVAuthToken, undefined);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
// console.log("Auth Token");
|
|
||||||
// console.log(PlexSession.plexTVAuthToken);
|
|
||||||
});
|
|
||||||
it("Get Plex User Data", async function () {
|
|
||||||
this.timeout(5000);
|
|
||||||
let response = await PlexSession.GetPlexUserData();
|
|
||||||
assert.notEqual(PlexSession.plexTVUserData, undefined);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
// console.log("User Data");
|
|
||||||
// console.log(PlexSession.plexTVUserData);
|
|
||||||
});
|
|
||||||
it("Get Plex Servers", async function () {
|
|
||||||
this.timeout(12000);
|
|
||||||
let response = await PlexSession.GetPlexServers({}, { owned: true });
|
|
||||||
assert.notEqual(PlexSession.plexServers, emptyArray);
|
|
||||||
assert.notEqual(PlexSession.plexServers, null);
|
|
||||||
assert.notEqual(PlexSession.plexServers, undefined);
|
|
||||||
assert.notEqual(PlexSession.plexDevices, emptyArray);
|
|
||||||
assert.notEqual(PlexSession.plexDevices, null);
|
|
||||||
assert.notEqual(PlexSession.plexDevices, undefined);
|
|
||||||
assert.notEqual(response, emptyArray);
|
|
||||||
assert.notEqual(response, null);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
// console.log("Plex Servers");
|
|
||||||
// console.log(PlexSession.plexServers);
|
|
||||||
});
|
|
||||||
it("Get Plex Libraries", async function () {
|
|
||||||
this.timeout(10000);
|
|
||||||
let response = await PlexSession.GetPlexLibraries();
|
|
||||||
assert.notEqual(PlexSession.plexLibraries, null);
|
|
||||||
assert.notEqual(PlexSession.plexLibraries, undefined);
|
|
||||||
assert.notEqual(PlexSession.plexLibraries, emptyArray);
|
|
||||||
assert.notEqual(response, emptyArray);
|
|
||||||
assert.notEqual(response, null);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
//console.log("Plex Libraries");
|
|
||||||
//console.log(PlexSession.plexLibraries);
|
|
||||||
});
|
|
||||||
it("Get Plex Movie Libraries", async function () {
|
|
||||||
this.timeout(20000);
|
|
||||||
let response = await PlexSession.GetPlexMovieLibraries();
|
|
||||||
assert.notEqual(response, emptyArray);
|
|
||||||
assert.notEqual(response, null);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
// console.log("Plex Movie Libraries");
|
|
||||||
// console.log(response);
|
|
||||||
});
|
|
||||||
it("Get Plex Music Libraries", async function () {
|
|
||||||
this.timeout(10000);
|
|
||||||
let response = await PlexSession.GetPlexMusicLibraries();
|
|
||||||
assert.notEqual(response, emptyArray);
|
|
||||||
assert.notEqual(response, null);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
// console.log("Plex Music Libraries");
|
|
||||||
// console.log(response);
|
|
||||||
});
|
|
||||||
it("Get Plex TV Libraries", async function () {
|
|
||||||
this.timeout(10000);
|
|
||||||
let response = await PlexSession.GetPlexTVShowLibraries();
|
|
||||||
assert.notEqual(response, emptyArray);
|
|
||||||
assert.notEqual(response, null);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
// console.log("Plex TV Libraries");
|
|
||||||
// console.log(response);
|
|
||||||
});
|
|
||||||
it("Get Plex Movies", async function () {
|
|
||||||
this.timeout(10000);
|
|
||||||
let response = await PlexSession.GetPlexMovies({
|
|
||||||
"X-Plex-Container-Start": 0,
|
|
||||||
"X-Plex-Container-Size": 2,
|
|
||||||
});
|
});
|
||||||
assert.notEqual(response, emptyArray);
|
it("Login", async function () {
|
||||||
assert.notEqual(response, null);
|
this.timeout(10000);
|
||||||
assert.notEqual(response, undefined);
|
setPlexClientInformation(await PlexLogin(plexClientInformation));
|
||||||
// console.log("Plex Movies");
|
assert.notEqual(plexTVAuthToken, null);
|
||||||
// console.log(response);
|
assert.notEqual(plexTVAuthToken, undefined);
|
||||||
});
|
console.log("Auth Token");
|
||||||
it("Get Plex Shows", async function () {
|
console.log(plexTVAuthToken);
|
||||||
this.timeout(10000);
|
|
||||||
let response = await PlexSession.GetPlexShows({
|
|
||||||
"X-Plex-Container-Start": 0,
|
|
||||||
"X-Plex-Container-Size": 2,
|
|
||||||
});
|
});
|
||||||
assert.notEqual(response, emptyArray);
|
it("Get Plex User Data", async function () {
|
||||||
assert.notEqual(response, null);
|
this.timeout(5000);
|
||||||
assert.notEqual(response, undefined);
|
setPlexUserData(
|
||||||
// console.log("Plex Shows");
|
await GetPlexUserData(plexClientInformation, plexTVAuthToken)
|
||||||
// console.log(response);
|
);
|
||||||
});
|
assert.notEqual(plexTVUserData, undefined);
|
||||||
it("Get Plex Seasons", async function () {
|
assert.notEqual(plexTVUserData, null);
|
||||||
this.timeout(10000);
|
console.log("User Data");
|
||||||
let response = await PlexSession.GetPlexSeasons({
|
console.log(plexTVUserData);
|
||||||
"X-Plex-Container-Start": 0,
|
|
||||||
"X-Plex-Container-Size": 2,
|
|
||||||
});
|
});
|
||||||
assert.notEqual(response, emptyArray);
|
it("Get Plex Servers", async function () {
|
||||||
assert.notEqual(response, null);
|
this.timeout(12000);
|
||||||
assert.notEqual(response, undefined);
|
setPlexServers(
|
||||||
// console.log("Plex Seasons");
|
await PlexSession.GetPlexServers(
|
||||||
// console.log(response);
|
plexClientInformation,
|
||||||
});
|
plexTVAuthToken,
|
||||||
it("Get Plex Episodes", async function () {
|
{
|
||||||
this.timeout(20000);
|
owned: true,
|
||||||
let response = await PlexSession.GetPlexEpisodes({
|
}
|
||||||
"X-Plex-Container-Start": 0,
|
)
|
||||||
"X-Plex-Container-Size": 2,
|
);
|
||||||
|
assert.notEqual(plexServers, emptyArray);
|
||||||
|
assert.notEqual(plexServers, null);
|
||||||
|
assert.notEqual(plexServers, undefined);
|
||||||
|
console.log("Plex Servers");
|
||||||
|
console.log(plexServers);
|
||||||
});
|
});
|
||||||
assert.notEqual(response, emptyArray);
|
// it("Get Plex Libraries", async function () {
|
||||||
assert.notEqual(response, null);
|
// this.timeout(10000);
|
||||||
assert.notEqual(response, undefined);
|
// let response = await PlexSession.GetPlexLibraries();
|
||||||
// console.log("Plex Episodes");
|
// assert.notEqual(PlexSession.plexLibraries, null);
|
||||||
// console.log(response);
|
// assert.notEqual(PlexSession.plexLibraries, undefined);
|
||||||
|
// assert.notEqual(PlexSession.plexLibraries, emptyArray);
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// //console.log("Plex Libraries");
|
||||||
|
// //console.log(PlexSession.plexLibraries);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Movie Libraries", async function () {
|
||||||
|
// this.timeout(20000);
|
||||||
|
// let response = await PlexSession.GetPlexMovieLibraries();
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Movie Libraries");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Music Libraries", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexMusicLibraries();
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Music Libraries");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex TV Libraries", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexTVShowLibraries();
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex TV Libraries");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Movies", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexMovies({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Movies");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Shows", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexShows({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Shows");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Seasons", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexSeasons({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Seasons");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Episodes", async function () {
|
||||||
|
// this.timeout(20000);
|
||||||
|
// let response = await PlexSession.GetPlexEpisodes({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Episodes");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Artists", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexArtists({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Artists");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Albums", async function () {
|
||||||
|
// this.timeout(10000);
|
||||||
|
// let response = await PlexSession.GetPlexAlbums({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Albums");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Songs", async function () {
|
||||||
|
// this.timeout(20000);
|
||||||
|
// let response = await PlexSession.GetPlexSongs({
|
||||||
|
// "X-Plex-Container-Start": 0,
|
||||||
|
// "X-Plex-Container-Size": 2,
|
||||||
|
// });
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// // console.log("Plex Songs");
|
||||||
|
// // console.log(response);
|
||||||
|
// });
|
||||||
|
// it("Get Plex Songs Paged", async function () {
|
||||||
|
// this.timeout(20000);
|
||||||
|
// let response = GetLibraryPages(PlexSession, "songs");
|
||||||
|
// assert.notEqual(response, emptyArray);
|
||||||
|
// assert.notEqual(response, null);
|
||||||
|
// assert.notEqual(response, undefined);
|
||||||
|
// console.log("Plex Songs Paged");
|
||||||
|
// console.log(response);
|
||||||
|
// });
|
||||||
});
|
});
|
||||||
it("Get Plex Artists", async function () {
|
}
|
||||||
this.timeout(10000);
|
|
||||||
let response = await PlexSession.GetPlexArtists({
|
UnitTests();
|
||||||
"X-Plex-Container-Start": 0,
|
|
||||||
"X-Plex-Container-Size": 2,
|
|
||||||
});
|
|
||||||
assert.notEqual(response, emptyArray);
|
|
||||||
assert.notEqual(response, null);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
// console.log("Plex Artists");
|
|
||||||
// console.log(response);
|
|
||||||
});
|
|
||||||
it("Get Plex Albums", async function () {
|
|
||||||
this.timeout(10000);
|
|
||||||
let response = await PlexSession.GetPlexAlbums({
|
|
||||||
"X-Plex-Container-Start": 0,
|
|
||||||
"X-Plex-Container-Size": 2,
|
|
||||||
});
|
|
||||||
assert.notEqual(response, emptyArray);
|
|
||||||
assert.notEqual(response, null);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
// console.log("Plex Albums");
|
|
||||||
// console.log(response);
|
|
||||||
});
|
|
||||||
it("Get Plex Songs", async function () {
|
|
||||||
this.timeout(20000);
|
|
||||||
let response = await PlexSession.GetPlexSongs({
|
|
||||||
"X-Plex-Container-Start": 0,
|
|
||||||
"X-Plex-Container-Size": 2,
|
|
||||||
});
|
|
||||||
assert.notEqual(response, emptyArray);
|
|
||||||
assert.notEqual(response, null);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
// console.log("Plex Songs");
|
|
||||||
// console.log(response);
|
|
||||||
});
|
|
||||||
it("Get Plex Songs Paged", async function () {
|
|
||||||
this.timeout(20000);
|
|
||||||
let response = PlexSession.GetLibraryPages("songs");
|
|
||||||
assert.notEqual(response, emptyArray);
|
|
||||||
assert.notEqual(response, null);
|
|
||||||
assert.notEqual(response, undefined);
|
|
||||||
//console.log("Plex Songs Paged");
|
|
||||||
//console.log(response);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
Reference in New Issue
Block a user