mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-22 01:43:29 +01:00
Part of AppLink login process
This commit is contained in:
@@ -1,38 +1,22 @@
|
||||
import request from "supertest";
|
||||
import makeServer from "../src/server";
|
||||
import { SONOS_DISABLED } from "../src/sonos";
|
||||
import { SONOS_DISABLED, SOAP_PATH } from "../src/sonos";
|
||||
|
||||
import { aService } from "./builders";
|
||||
import { aService, InMemoryMusicService } from "./builders";
|
||||
import supersoap from './supersoap';
|
||||
|
||||
import { createClientAsync } from "soap";
|
||||
|
||||
describe("ws", () => {
|
||||
describe("can call getSessionId", () => {
|
||||
it("should do something", async () => {
|
||||
const server = makeServer(SONOS_DISABLED, aService());
|
||||
const WEB_ADDRESS = 'http://localhost:7653'
|
||||
const server = makeServer(SONOS_DISABLED, aService(), WEB_ADDRESS, new InMemoryMusicService());
|
||||
|
||||
const { username, sessionId } = await createClientAsync(
|
||||
`http://localhost/ws?wsdl`,
|
||||
`${WEB_ADDRESS}${SOAP_PATH}?wsdl`,
|
||||
{
|
||||
endpoint: `http://localhost/ws`,
|
||||
httpClient: {
|
||||
request: (
|
||||
rurl: string,
|
||||
data: any,
|
||||
callback: (error: any, res?: any, body?: any) => any,
|
||||
exheaders?: any
|
||||
) => {
|
||||
const withoutHost = rurl.replace("http://localhost", "");
|
||||
const req =
|
||||
data == null
|
||||
? request(server).get(withoutHost).send()
|
||||
: request(server).post(withoutHost).send(data);
|
||||
req
|
||||
.set(exheaders || {})
|
||||
.then((response) => callback(null, response, response.text))
|
||||
.catch(callback);
|
||||
},
|
||||
},
|
||||
endpoint: `${WEB_ADDRESS}${SOAP_PATH}`,
|
||||
httpClient: supersoap(server, WEB_ADDRESS),
|
||||
}
|
||||
).then((client) =>
|
||||
client
|
||||
|
||||
Reference in New Issue
Block a user