def test_tuple_without_required():
    """
    Force the failured of the ``has_required_arguments()`` on ProvTuple.

    Currently, ``has_required_arguments()`` is used in the definition of
    ``validate()`` (at least when this test was written).

    The required fields for a request for provenance logging are:

    - ``uuid``
    - ``service_name``
    - ``category_name``
    - ``event_name``
    - ``username``

    A call to has_required_arguments() will verify that none of these
    attributes are ``None``.

    In the constructor, none of the arguments are optional.  Therefore,
    all newly instantiated ``ProvTuple`` objects are valid until any of
    the attributes are mucked with or manipulated.
    """
    prov = ProvTuple(9090909090, 'DE', 'view', 'list-dir', 'tester',
                '10.0.0.1')
    assert prov.has_required_arguments()

    tmp = prov.uuid
    prov.uuid = None
    assert not prov.has_required_arguments()

    prov.uuid = tmp
    tmp = prov.service_name
    prov.service_name = None
    assert not prov.has_required_arguments()

    prov.service_name = tmp
    tmp = prov.category_name
    prov.category_name = None
    assert not prov.has_required_arguments()

    prov.category_name = tmp
    tmp = prov.event_name
    prov.event_name = None
    assert not prov.has_required_arguments()

    prov.event_name = tmp
    tmp = prov.username
    prov.username = None
    assert not prov.has_required_arguments()

    prov.username = None
    prov.event_name  = None
    prov.category_name = None
    prov.service_name = None
    prov.uuid = None
    assert not prov.has_required_arguments()
def test_tuple_without_required():
    """
    Force the failured of the ``has_required_arguments()`` on ProvTuple.

    Currently, ``has_required_arguments()`` is used in the definition of
    ``validate()`` (at least when this test was written).

    The required fields for a request for provenance logging are:

    - ``uuid``
    - ``service_name``
    - ``category_name``
    - ``event_name``
    - ``username``

    A call to has_required_arguments() will verify that none of these
    attributes are ``None``.

    In the constructor, none of the arguments are optional.  Therefore,
    all newly instantiated ``ProvTuple`` objects are valid until any of
    the attributes are mucked with or manipulated.
    """
    prov = ProvTuple(9090909090, 'DE', 'view', 'list-dir', 'tester',
                     '10.0.0.1')
    assert prov.has_required_arguments()

    tmp = prov.uuid
    prov.uuid = None
    assert not prov.has_required_arguments()

    prov.uuid = tmp
    tmp = prov.service_name
    prov.service_name = None
    assert not prov.has_required_arguments()

    prov.service_name = tmp
    tmp = prov.category_name
    prov.category_name = None
    assert not prov.has_required_arguments()

    prov.category_name = tmp
    tmp = prov.event_name
    prov.event_name = None
    assert not prov.has_required_arguments()

    prov.event_name = tmp
    tmp = prov.username
    prov.username = None
    assert not prov.has_required_arguments()

    prov.username = None
    prov.event_name = None
    prov.category_name = None
    prov.service_name = None
    prov.uuid = None
    assert not prov.has_required_arguments()