Skip to content

Commit

Permalink
[LIMS] - Added mockup for create_session, still used by Qt mockup code
Browse files Browse the repository at this point in the history
  • Loading branch information
marcus-oscarsson committed Nov 29, 2024
1 parent c058086 commit 55bbce1
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions mxcubecore/HardwareObjects/mockup/ISPyBClientMockup.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,22 +97,7 @@ def _authenticate(self, user_name, password):
if password == "ispybDown":
raise Exception("Could not authenticate")

def login(
self, user_name: str, password: str, is_local_host: bool
) -> LimsSessionManager:
logging.getLogger("HRW").debug(
"Login on ISPyBLims proposal=%s is_local_host=%s"
% (user_name, str(is_local_host)),
)
self._authenticate(user_name, password)
self.session_manager = LimsSessionManager()
# Authentication
try:
self._authenticate(user_name, password)
self.user_name = user_name
except BaseException as e:
raise e

def _create_test_session(self):
session_dict = {
"session_id": "1565334143",
"beamline_name": "ID23-1",
Expand All @@ -135,10 +120,31 @@ def login(
"data_portal_URL": "https://data2.esrf.fr/investigation/1565334143/datasets",
"logbook_URL": "https://data2.esrf.fr/investigation/1565334143/logbook",
}

session: Session = Session(**session_dict)
self.session_manager = LimsSessionManager(
sessions=[session], active_session=session
return LimsSessionManager(sessions=[session], active_session=session)

def login(
self, user_name: str, password: str, is_local_host: bool
) -> LimsSessionManager:
logging.getLogger("HRW").debug(
"Login on ISPyBLims proposal=%s is_local_host=%s"
% (user_name, str(is_local_host)),
)
self._authenticate(user_name, password)
self.session_manager = LimsSessionManager()
# Authentication
try:
self._authenticate(user_name, password)
self.user_name = user_name
except BaseException as e:
raise e

self.session_manager = self._create_test_session()
return self.session_manager

def create_session(self, proposal):
self.session_manager = self._create_test_session()
return self.session_manager

def get_proposal(self, proposal_code, proposal_number):
Expand Down

0 comments on commit 55bbce1

Please sign in to comment.