UNPKG

4.78 kBTypeScriptView Raw
1/// <reference types="jest" />
2import { ReadonlyJSONObject } from '@lumino/coreutils';
3import { AttachedProperty } from '@lumino/properties';
4import { ISignal } from '@lumino/signaling';
5import { BaseManager } from './basemanager';
6import { Contents } from './contents';
7import { Kernel, KernelMessage } from './kernel';
8import { KernelSpec } from './kernelspec';
9import { ServiceManager } from './manager';
10import { ServerConnection } from './serverconnection';
11import { Session } from './session';
12import { User, UserManager } from './user';
13export declare const DEFAULT_NAME = "python3";
14export declare const KERNELSPECS: {
15 [key: string]: KernelSpec.ISpecModel;
16};
17export declare const KERNEL_MODELS: Kernel.IModel[];
18export declare const NOTEBOOK_PATHS: {
19 [kernelName: string]: string[];
20};
21/**
22 * Clone a kernel connection.
23 */
24export declare function cloneKernel(kernel: Kernel.IKernelConnection): Kernel.IKernelConnection;
25/**
26 * A mock kernel object.
27 *
28 * @param model The model of the kernel
29 */
30export declare const KernelMock: jest.Mock<Kernel.IKernelConnection, [Private.RecursivePartial<Kernel.IKernelConnection.IOptions>], any>;
31/**
32 * A mock session connection.
33 *
34 * @param options Addition session options to use
35 * @param model A session model to use
36 */
37export declare const SessionConnectionMock: jest.Mock<Session.ISessionConnection, [Private.RecursivePartial<Session.ISessionConnection.IOptions>, Kernel.IKernelConnection | null], any>;
38/**
39 * A mock contents manager.
40 */
41export declare const ContentsManagerMock: jest.Mock<Contents.IManager, [], any>;
42/**
43 * A mock sessions manager.
44 */
45export declare const SessionManagerMock: jest.Mock<Session.IManager, [], any>;
46/**
47 * A mock kernel specs manager
48 */
49export declare const KernelSpecManagerMock: jest.Mock<KernelSpec.IManager, [], any>;
50/**
51 * A mock service manager.
52 */
53export declare const ServiceManagerMock: jest.Mock<ServiceManager.IManager, [], any>;
54/**
55 * A mock kernel shell future.
56 */
57export declare const MockShellFuture: jest.Mock<Kernel.IShellFuture<KernelMessage.IShellMessage<KernelMessage.ShellMessageType>, KernelMessage.IShellMessage<KernelMessage.ShellMessageType>>, [KernelMessage.IShellMessage<KernelMessage.ShellMessageType>], any>;
58export declare function changeKernel(kernel: Kernel.IKernelConnection, partialModel: Partial<Kernel.IModel>): Promise<Kernel.IKernelConnection>;
59/**
60 * A namespace for module private data.
61 */
62declare namespace Private {
63 type RecursivePartial<T> = {
64 [P in keyof T]?: RecursivePartial<T[P]>;
65 };
66 function createFile(options?: Contents.ICreateOptions): Contents.IModel;
67 function fixSlash(path: string): string;
68 function makeResponseError<T>(status: number): Promise<T>;
69 function cloneKernel(options: RecursivePartial<Kernel.IKernelConnection.IOptions>): Kernel.IKernelConnection;
70 function kernelSpecForKernelName(name: string): KernelSpec.ISpecModel;
71 function getInfo(name: string): KernelMessage.IInfoReply;
72 const RUNNING_KERNELS: Kernel.IKernelConnection[];
73 const lastMessageProperty: AttachedProperty<Kernel.IKernelConnection, string>;
74}
75/**
76 * The user API service manager.
77 */
78export declare class FakeUserManager extends BaseManager implements User.IManager {
79 private _isReady;
80 private _ready;
81 private _identity;
82 private _permissions;
83 private _userChanged;
84 private _connectionFailure;
85 /**
86 * Create a new user manager.
87 */
88 constructor(options: UserManager.IOptions | undefined, identity: User.IIdentity, permissions: ReadonlyJSONObject);
89 /**
90 * The server settings for the manager.
91 */
92 readonly serverSettings: ServerConnection.ISettings;
93 /**
94 * Test whether the manager is ready.
95 */
96 get isReady(): boolean;
97 /**
98 * A promise that fulfills when the manager is ready.
99 */
100 get ready(): Promise<void>;
101 /**
102 * Get the most recently fetched identity.
103 */
104 get identity(): User.IIdentity | null;
105 /**
106 * Get the most recently fetched permissions.
107 */
108 get permissions(): ReadonlyJSONObject | null;
109 /**
110 * A signal emitted when the user changes.
111 */
112 get userChanged(): ISignal<this, User.IUser>;
113 /**
114 * A signal emitted when there is a connection failure.
115 */
116 get connectionFailure(): ISignal<this, Error>;
117 /**
118 * Dispose of the resources used by the manager.
119 */
120 dispose(): void;
121 /**
122 * Force a refresh of the specs from the server.
123 *
124 * @returns A promise that resolves when the specs are fetched.
125 *
126 * #### Notes
127 * This is intended to be called only in response to a user action,
128 * since the manager maintains its internal state.
129 */
130 refreshUser(): Promise<void>;
131}
132export {};