Exemplo n.º 1
0
def test_equality_not_equals():
    """Check two vfs are not equals if name is not the same."""
    vf_1 = Vf(name="equal")
    vf_1.identifier = "1234"
    vf_2 = Vf(name="not_equal")
    vf_2.identifier = "1234"
    assert vf_1 != vf_2
Exemplo n.º 2
0
def test_equality_really_equals():
    """Check two vfs are equals if name is the same."""
    vf_1 = Vf(name="equal")
    vf_1.identifier = "1234"
    vf_2 = Vf(name="equal")
    vf_2.identifier = "1235"
    assert vf_1 == vf_2
def test__get_item_details_created(mock_send):
    vf = Vf()
    vf.identifier = "1234"
    mock_send.return_value = {'return': 'value'}
    assert vf._get_item_details() == {'return': 'value'}
    mock_send.assert_called_once_with(
        'GET', 'get item', "{}/items/1234/versions".format(vf._base_url()))
Exemplo n.º 4
0
def test_version_no_load_created(mock_load):
    """Test versions when created."""
    vf = Vf()
    vf.identifier = "1234"
    vf._version = "64"
    assert vf.version == "64"
    mock_load.assert_not_called()
Exemplo n.º 5
0
def test_exists_not_exists(mock_get_all):
    """Return False if vf doesn't exist in SDC."""
    vf_1 = Vf(name="one")
    vf_1.identifier = "1234"
    mock_get_all.return_value = [vf_1]
    vf = Vf(name="two")
    assert not vf.exists()
Exemplo n.º 6
0
def test_equality_not_equals_not_same_object():
    """Check a vf and something different are not equals."""
    vf_1 = Vf(name="equal")
    vf_1.identifier = "1234"
    vf_2 = SdcResource()
    vf_2.name = "equal"
    assert vf_1 != vf_2
def test__deep_load_no_response(mock_send, mock_created):
    mock_created.return_value = True
    vf = Vf()
    vf.identifier = "1234"
    vf._version = "4567"
    vf._status = const.CHECKED_IN
    mock_send.return_value = {}
    vf.deep_load()
    assert vf._unique_identifier is None
    mock_send.assert_called_once_with(
        'GET',
        'Deep Load Vf',
        "{}/sdc1/feProxy/rest/v1/screen?excludeTypes=VFCMT&excludeTypes=Configuration"
        .format(vf.base_front_url),
        headers=headers_sdc_creator(vf.headers))
Exemplo n.º 8
0
def test_exists_exists(mock_get_all):
    """Return True if vf exists in SDC."""
    vf_1 = Vf(name="one")
    vf_1.identifier = "1234"
    vf_1.unique_uuid = "5689"
    vf_1.unique_identifier = "71011"
    vf_1.status = const.DRAFT
    vf_1.version = "1.1"
    mock_get_all.return_value = [vf_1]
    vf = Vf(name="one")
    assert vf.exists()
    assert vf.identifier == "1234"
    assert vf.unique_uuid == "5689"
    assert vf.unique_identifier == "71011"
    assert vf.status == const.DRAFT
    assert vf.version == "1.1"
def test__deep_load_response_NOK_under_cert(mock_send, mock_created):
    mock_created.return_value = True
    vf = Vf()
    vf.identifier = "5678"
    vf._version = "4567"
    vf._status = const.UNDER_CERTIFICATION
    mock_send.return_value = {
        'resources': [{
            'uuid': '5689',
            'name': 'test',
            'uniqueId': '71011'
        }]
    }
    vf.deep_load()
    assert vf._unique_identifier is None
    mock_send.assert_called_once_with(
        'GET',
        'Deep Load Vf',
        "{}/sdc1/feProxy/rest/v1/screen?excludeTypes=VFCMT&excludeTypes=Configuration"
        .format(vf.base_front_url),
        headers=headers_sdc_tester(vf.headers))
def test__unique_uuid_setter():
    vf = Vf()
    vf.identifier = "1234"
    vf.unique_uuid = "4567"
    assert vf._unique_uuid == "4567"
def test__unique_uuid_load(mock_load):
    vf = Vf()
    vf.identifier = "1234"
    assert vf.unique_uuid == None
    mock_load.assert_called_once()
def test__unique_uuid_no_load(mock_load):
    vf = Vf()
    vf.identifier = "1234"
    vf._unique_uuid = "4567"
    assert vf.unique_uuid == "4567"
    mock_load.assert_not_called()
def test__get_items_version_details_no_version(mock_send, mock_load):
    vf = Vf()
    vf.identifier = "1234"
    assert vf._get_item_version_details() == {}
    mock_send.assert_not_called()
def test__status_setter():
    vf = Vf()
    vf.identifier = "1234"
    vf.status = "4567"
    assert vf._status == "4567"
def test__unique_identifier_no_load(mock_load):
    vf = Vf()
    vf.identifier = "1234"
    vf._unique_identifier = "toto"
    assert vf.unique_identifier == "toto"
    mock_load.assert_not_called()
Exemplo n.º 16
0
def test_version_with_load(mock_load):
    """Test versions when not created but with identifier."""
    vf = Vf()
    vf.identifier = "1234"
    assert vf.version is None
    mock_load.assert_called_once()