schrodinger.test.ld_mock_modules module¶
- class schrodinger.test.ld_mock_modules.MockLogin(host='https://unit_test-8-5.dev.bb.schrodinger.com')¶
Bases:
objectA mock of the
applications.livedesign.loginmodule for use in testing.- HOST = 'host'¶
- USERNAME = 'username'¶
- CLIENT = 'client'¶
- MODELS = 'models'¶
- VERSION_NUMBER = 'seurat_version_number'¶
- COMPATIBILITY_MODE = 'compatibility_mode'¶
- LD_MODE = 'LIVEDESIGN_MODE'¶
- LDCLIENT_PATH = '/livedesign/ldclient.tar.gz'¶
- API_PATH = '/livedesign/api'¶
- GLOBAL_PROJECT_ID = '0'¶
- LD_VERSION_COMPATIBILITY_MODE = Version(major=2022, minor=1)¶
- LD_VERSION_3D_PROTOCOL = Version(major=9, minor=1)¶
- VERSION_MISMATCH_MSG = 'There is a mismatch between the client version and the server version. Please try restarting Maestro.'¶
- INVALID_CREDENTIALS_MSG = 'Invalid username or password.'¶
- INVALID_TOKEN_MSG = 'Invalid token.'¶
- IMPORT_ERROR_MSG = 'Could not successfully import the necessary files fetched from the server.'¶
- CONTACT_SUPPORT_MSG = '\nPlease contact Schrodinger Technical Support with the hostname used to login.'¶
- NO_CONNECTION_MSG = 'Cannot connect to specified host.'¶
- class Version(major, minor)¶
Bases:
tuple- __contains__(key, /)¶
Return key in self.
- __len__()¶
Return len(self).
- count(value, /)¶
Return number of occurrences of value.
- index(value, start=0, stop=9223372036854775807, /)¶
Return first index of value.
Raises ValueError if the value is not present.
- major¶
Alias for field number 0
- minor¶
Alias for field number 1
- __init__(host='https://unit_test-8-5.dev.bb.schrodinger.com')¶
- get_ld_client_and_models()¶
Return the stored
ldclient.client.LDClientandldclient.modelsmocks.Providing the same
LDClientinstance every time allows modifications to the “server state” (actually stored on theLDClientmock) made in unit tests to be reflected in the modules in whichloginhas been patched out withMockLogin.
- get_LD_version(ld_client=None)¶
- Parameters
ld_client (mock.Mock) – a mock of the
client.LDClientclass, with a properly-behavingabout()method defined (optional)- Returns
the version of the supplied LD client instance
- Return type
- get_LD_mode(ld_client)¶
- Parameters
ld_client (mock.Mock) – a mock of the
client.LDClientclass, with amodeattribute defined- Returns
the LD mode of supplied LD client instance; expect to be a string representations of one of the values of
login.LDMode- Return type
str
- required_login_info_set()¶
- get_host()¶
- Returns
the LiveDesign host server for this session
- Return type
str
- get_username()¶
- Returns
the LiveDesign user name for this session
- Return type
str
- get_credentials()¶
- Returns
the username and password for this session, if available
- Return type
tuple(str, str) or tuple(None, None)
- download_ld_client(url: str, tmp_dir: str, tar_filename: str, glob_path: str, timeout: Optional[int] = None) str¶
Mock implementation of
login.download_ld_client().- Returns
the path to the downloaded client directory