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'
LD_MODE = 'LIVEDESIGN_MODE'
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)
__init__(host='https://unit_test-8-5.dev.bb.schrodinger.com')[source]

Initialize self. See help(type(self)) for accurate signature.

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)