skipcheck

TM1 Testcontainers · Docs · More

Tm1Database

from skipcheck_tm1_testcontainers import Tm1Database

A database of a Tm1EngineContainer: what a test of TM1 v12 uses.

An engine holds instances, and an instance holds databases. The REST API of one database is at rest_url; a user logs in to its instance (login), and the session serves every database there.

Members

__init__ constructor
engine propertyThe engine this database is in.
instance propertyThe instance this database is in; tm1 unless one was named.
name propertyThe database's name.
rest_url propertyThe REST API's service root as seen from the host, ending in /, e.g.
version propertyThe version of TM1 the engine runs.
loginA login as a user.
oauth2_loginA login through OAuth 2.0.
pass_through_loginA pass-through login.
pass_through_login_withA pass-through login with an Authorization header of your own, which TM1 v12 passes on as it is.

__init__

constructor
__init__(engine: Tm1EngineContainer, instance: str, name: str) -> None

engine

property
engine: Tm1EngineContainer

The engine this database is in.

instance

property
instance: str

The instance this database is in; tm1 unless one was named.

name

property
name: str

The database's name.

rest_url

property
rest_url: str

The REST API's service root as seen from the host, ending in /, e.g. http://localhost:54321/tm1/api/v1/Databases('planning')/.

version

property
version: Tm1Version

The version of TM1 the engine runs. Only available once it has started.

login

login(user: str = 'admin') -> Tm1Login

A login as a user: admin, the administrator every database has, unless one is named. TM1 makes a session for any name; a user who isn't in this database is then refused here (403).

oauth2_login

oauth2_login(user: str) -> Tm1Login

A login through OAuth 2.0: as a user the engine's Keycloak knows the password of (Tm1EngineContainer.with_login). The login gets a token from Keycloak with that password and sends it to TM1, as a program acting for the user would. A RuntimeError if the engine has no Tm1EngineContainer.with_oauth2, and a ValueError if the user has no password.

pass_through_login

pass_through_login(user: str | None = None, password: str | None = None) -> Tm1Login

A pass-through login: it sends TM1 v12 what the TM1 11 server takes, and TM1 v12 asks that server who that is.

* pass_through_login(): as the server's own user (Tm1ServerContainer.username): the administrator of a server with its own users, or the first administrator of one in Cognos (CAM) security. * pass_through_login(user): as a user whose password the containers know: one of Cognos's test users when the server is in CAM security, and otherwise the server's own user only. A ValueError if the user's password isn't known. * pass_through_login(user, password): with a name and password of your own: a user you created on the TM1 11 server, or a wrong password to see refused. They go as Basic, or as CAMNamespace when the server is in CAM security.

A RuntimeError if the engine has no Tm1EngineContainer.with_pass_through.

pass_through_login_with

pass_through_login_with(authorization: str) -> Tm1Login

A pass-through login with an Authorization header of your own, which TM1 v12 passes on as it is: "CAMPassport " + passport from a Cognos logon, say. The login has no user name or password. A RuntimeError if the engine has no Tm1EngineContainer.with_pass_through.