Esempio n. 1
0
def test_sid():
    # Good
    inst = SAPHostCtrlInstances(context_wrap(SAPHOSTCTRL_HOSTINSTANCES))
    hn = Hostname(HostnameParser(context_wrap(HOSTNAME)), None, None, None)
    sap = Sap(hn, inst, None)
    broker = {Sap: sap}
    broker.update({LocalSpecs.sap_instance: LocalSpecs.sap_instance(broker)})
    result = sap_sid(broker)
    assert result is not None
    assert isinstance(result, list)
    assert result == sorted(set(v.sid.lower() for v in sap.values()))
Esempio n. 2
0
def test_hana_sid_SID_nr():
    # Good
    inst = SAPHostCtrlInstances(context_wrap(SAPHOSTCTRL_HOSTINSTANCES))
    hn = Hostname(HostnameParser(context_wrap(HOSTNAME)), None, None, None)
    sap = Sap(hn, inst, None)
    broker = {Sap: sap}
    broker.update({LocalSpecs.sap_instance: LocalSpecs.sap_instance(broker)})
    broker.update(
        {LocalSpecs.sap_hana_instance: LocalSpecs.sap_hana_instance(broker)})
    result = sap_hana_sid_SID_nr(broker)
    assert result is not None
    assert isinstance(result, list)
    assert result == list((v.sid.lower(), v.sid, v.number)
                          for v in sap.values() if v.type == 'HDB')

    # Bad
    broker.update({LocalSpecs.sap_hana_instance: []})
    with pytest.raises(SkipComponent):
        sap_hana_sid_SID_nr(broker)