from db.master_static_field_mapping import CREATE_NEW_ACTION, CREATE_NEW_MARKER, _resolve_channel_mapping


def test_resolve_channel_mapping_create_new_uses_master_code():
    code, action = _resolve_channel_mapping(
        {"magento": CREATE_NEW_MARKER},
        "magento",
        "door_style",
    )
    assert code == "door_style"
    assert action == CREATE_NEW_ACTION


def test_resolve_channel_mapping_existing_attribute():
    code, action = _resolve_channel_mapping(
        {"shopify": "custom_door_style"},
        "shopify",
        "door_style",
    )
    assert code == "custom_door_style"
    assert action == "use_existing"
