Exemplo n.º 1
0
def test_serialize_deserialize(tide, json_):
    """
    test serialize/deserialize/update_from_dict doesn't raise errors
    """
    c_cats = CatsMover(curr_file, tide=tide)

    toserial = c_cats.serialize(json_)
    dict_ = c_cats.deserialize(toserial)

    # check our CatsMover attributes
    if json_ == 'webapi':
        assert toserial['filename'] == basename(toserial['filename'])
    else:
        # in save context, we expect a full path to file
        assert toserial['filename'] != basename(toserial['filename'])

    if tide:
        assert 'tide' in toserial
        dict_['tide'] = tide  # no longer updating properties of nested objects
        assert c_cats.tide is tide

        if json_ == 'webapi':
            assert (toserial['tide']['filename'] ==
                    basename(toserial['tide']['filename']))
        else:
            assert (toserial['tide']['filename'] !=
                    basename(toserial['tide']['filename']))

    c_cats.update_from_dict(dict_)
Exemplo n.º 2
0
def test_serialize_deserialize(tide, json_):
    """
    test serialize/deserialize/update_from_dict doesn't raise errors
    """
    c_cats = CatsMover(curr_file, tide=tide)

    toserial = c_cats.serialize(json_)
    dict_ = c_cats.deserialize(toserial)

    # check our CatsMover attributes
    if json_ == 'webapi':
        assert toserial['filename'] == basename(toserial['filename'])
    else:
        # in save context, we expect a full path to file
        assert toserial['filename'] != basename(toserial['filename'])

    if tide:
        assert 'tide' in toserial
        dict_['tide'] = tide  # no longer updating properties of nested objects
        assert c_cats.tide is tide

        if json_ == 'webapi':
            assert (toserial['tide']['filename'] == basename(
                toserial['tide']['filename']))
        else:
            assert (toserial['tide']['filename'] != basename(
                toserial['tide']['filename']))

    c_cats.update_from_dict(dict_)
Exemplo n.º 3
0
def test_serialize_deserialize(tide):
    """
    test serialize/deserialize/update_from_dict doesn't raise errors
    """

    c_cats = CatsMover(curr_file, tide=tide)
    toserial = c_cats.serialize('webapi')
    dict_ = c_cats.deserialize(toserial)
    if tide:
        assert 'tide' in toserial
        dict_['tide'] = tide  # no longer updating properties of nested objects
        assert c_cats.tide is tide

    c_cats.update_from_dict(dict_)