This commit is contained in:
@@ -21,11 +21,12 @@ def test_get_beamline(instrument, expected_beamline):
|
||||
|
||||
def test_get_pvname_reprate_for_inferred_beamline():
|
||||
"""Test the PV name retrieval when using inferred beamline based on IP address."""
|
||||
# Mock the socket to simulate an IP address
|
||||
with patch("socket.gethostname", return_value="testhost"), patch("socket.gethostbyname", return_value="129.129.242"):
|
||||
beamline = infer_beamline()
|
||||
pvname = get_pvname_reprate(instrument=None, beamline=beamline)
|
||||
assert pvname == "alvra"
|
||||
beamline = infer_beamline() # This will return "alvra" based on the IP
|
||||
pvname = get_pvname_reprate(instrument=None, beamline=beamline) # This should return the PV name associated with 'aramis'
|
||||
expected_pvname = "SIN-TIMAST-TMA:Bunch-1-Exp-Freq-RB"
|
||||
assert pvname == expected_pvname, f"Expected {expected_pvname}, but got {pvname}"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("ip,expected_instrument", [
|
||||
("129.129.242", "alvra"),
|
||||
|
||||
Reference in New Issue
Block a user