schrodinger.test.ld_mock_modules module

class schrodinger.test.ld_mock_modules.MockLogin(host='https://unit_test-8-5.dev.bb.schrodinger.com')[source]

Bases: object

A mock of the applications.livedesign.login module 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_CORP_ID_MATCHING = Version(major=8, minor=1)
LD_VERSION_MULTIPLE_IDS = Version(major=8, minor=1)
LD_VERSION_REAL_VIRTUAL = Version(major=8, minor=2)
LD_VERSION_NEW_EXPORT = Version(major=8, minor=7)
LD_VERSION_NEW_IMPORT = Version(major=8, minor=9)
LD_VERSION_POSE_NAMES = Version(major=8, minor=9)
LD_VERSION_COMPATIBILITY_MODE = Version(major=8, minor=10)
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')[source]
get_ld_client_and_models()[source]

Return the stored ldclient.client.LDClient and ldclient.models mocks.

Providing the same LDClient instance every time allows modifications to the “server state” (actually stored on the LDClient mock) made in unit tests to be reflected in the modules in which login has been patched out with MockLogin.

get_LD_version(ld_client=None)[source]
Parameters

ld_client (mock.Mock) – a mock of the client.LDClient class, with a properly-behaving about() method defined (optional)

Returns

the version of the supplied LD client instance

Return type

login.Version

get_LD_mode(ld_client)[source]
Parameters

ld_client (mock.Mock) – a mock of the client.LDClient class, with a mode attribute 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()[source]
get_host()[source]
Returns

the LiveDesign host server for this session

Return type

str

get_username()[source]
Returns

the LiveDesign user name for this session

Return type

str

get_credentials()[source]
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[source]

Mock implementation of login.download_ld_client().

Returns

the path to the downloaded client directory