Esempio n. 1
0
def test_cmd_list_serializers(capsys):

    # tests with no de/serializers set up
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    # set up some serializers
    serial_provider = serializer_provider_factory()
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    serializers.disconnect(serial_provider)

    # set up some deserializers
    deserial_provider = deserializer_provider_factory()
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    # empty again
    deserializers.disconnect(deserial_provider)
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    # with both set up
    deserial_provider = deserializer_provider_factory()
    serial_provider = serializer_provider_factory()
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)
    serializers.disconnect(serial_provider)
    deserializers.disconnect(deserial_provider)
Esempio n. 2
0
def test_cmd_list_serializers(capsys):

    # tests with no de/serializers set up
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    # set up some serializers
    serial_provider = serializer_provider_factory()
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    serializers.disconnect(serial_provider)

    # set up some deserializers
    deserial_provider = deserializer_provider_factory()
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    # empty again
    deserializers.disconnect(deserial_provider)
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    # with both set up
    deserial_provider = deserializer_provider_factory()
    serial_provider = serializer_provider_factory()
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)
    serializers.disconnect(serial_provider)
    deserializers.disconnect(deserial_provider)
Esempio n. 3
0
def test_cmd_list_serializers_for_model(capsys):

    # tests with no de/serializers set up
    call_command("list_serializers", "-m", "pootle_project.project")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err, Project)

    # set up some serializers
    serial_provider = serializer_provider_factory(Project)
    call_command("list_serializers", "-m", "pootle_project.project")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err, Project)
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    serializers.disconnect(serial_provider)

    # set up some deserializers
    deserial_provider = deserializer_provider_factory(Project)
    call_command("list_serializers", "-m", "pootle_project.project")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err, Project)
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    # empty again
    deserializers.disconnect(deserial_provider)
    call_command("list_serializers", "-m", "pootle_project.project")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err, Project)
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    # with both set up
    deserial_provider = deserializer_provider_factory(Project)
    serial_provider = serializer_provider_factory(Project)
    call_command("list_serializers", "-m", "pootle_project.project")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err, Project)
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)
    serializers.disconnect(serial_provider)
    deserializers.disconnect(deserial_provider)
Esempio n. 4
0
def test_cmd_list_serializers_for_model(capsys):

    # tests with no de/serializers set up
    call_command("list_serializers", "-m", "pootle_project.project")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err, Project)

    # set up some serializers
    serial_provider = serializer_provider_factory(Project)
    call_command("list_serializers", "-m", "pootle_project.project")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err, Project)
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    serializers.disconnect(serial_provider)

    # set up some deserializers
    deserial_provider = deserializer_provider_factory(Project)
    call_command("list_serializers", "-m", "pootle_project.project")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err, Project)
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    # empty again
    deserializers.disconnect(deserial_provider)
    call_command("list_serializers", "-m", "pootle_project.project")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err, Project)
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)

    # with both set up
    deserial_provider = deserializer_provider_factory(Project)
    serial_provider = serializer_provider_factory(Project)
    call_command("list_serializers", "-m", "pootle_project.project")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err, Project)
    call_command("list_serializers")
    out, err = capsys.readouterr()
    _test_serializer_list(out, err)
    serializers.disconnect(serial_provider)
    deserializers.disconnect(deserial_provider)