Beispiel #1
0
    def test_convert_to_extras_output_unflattened_with_correct_index(self):

        key = ('test_field', )
        data = {
            ('test_field', ): 'test_value',
            ('extras', 0, 'deleted'): '',
            ('extras', 0, 'id'): '',
            ('extras', 0, 'key'): 'proper_extra',
            ('extras', 0, 'revision_timestamp'): '',
            ('extras', 0, 'state'): '',
            ('extras', 0, 'value'): 'proper_extra_value',
        }
        errors = {}
        context = {}

        converters.convert_to_extras(key, data, errors, context)

        eq_(data[('extras', 0, 'key')], 'proper_extra')
        eq_(data[('extras', 0, 'value')], 'proper_extra_value')
        eq_(data[('extras', 1, 'key')], 'test_field')
        eq_(data[('extras', 1, 'value')], 'test_value')

        assert not ('extras', ) in data

        eq_(errors, {})
Beispiel #2
0
def test_convert_to_extras_output_unflattened_with_correct_index():

    key = ("test_field", )
    data = {
        ("test_field", ): "test_value",
        ("extras", 0, "deleted"): "",
        ("extras", 0, "id"): "",
        ("extras", 0, "key"): "proper_extra",
        ("extras", 0, "revision_timestamp"): "",
        ("extras", 0, "state"): "",
        ("extras", 0, "value"): "proper_extra_value",
    }
    errors = {}
    context = {}

    converters.convert_to_extras(key, data, errors, context)

    assert data[("extras", 0, "key")] == "proper_extra"
    assert data[("extras", 0, "value")] == "proper_extra_value"
    assert data[("extras", 1, "key")] == "test_field"
    assert data[("extras", 1, "value")] == "test_value"

    assert ("extras", ) not in data

    assert errors == {}
Beispiel #3
0
    def test_convert_to_extras_output_unflattened_with_correct_index(self):

        key = ('test_field',)
        data = {
            ('test_field',): 'test_value',
            ('extras', 0, 'deleted'): '',
            ('extras', 0, 'id'): '',
            ('extras', 0, 'key'): 'proper_extra',
            ('extras', 0, 'revision_timestamp'): '',
            ('extras', 0, 'state'): '',
            ('extras', 0, 'value'): 'proper_extra_value',
        }
        errors = {}
        context = {}

        converters.convert_to_extras(key, data, errors, context)

        eq_(data[('extras', 0, 'key')], 'proper_extra')
        eq_(data[('extras', 0, 'value')], 'proper_extra_value')
        eq_(data[('extras', 1, 'key')], 'test_field')
        eq_(data[('extras', 1, 'value')], 'test_value')

        assert not ('extras',) in data

        eq_(errors, {})
Beispiel #4
0
def test_convert_to_extras_output_unflattened():

    key = ("test_field", )
    data = {("test_field", ): "test_value"}
    errors = {}
    context = {}

    converters.convert_to_extras(key, data, errors, context)

    assert data[("extras", 0, "key")] == "test_field"
    assert data[("extras", 0, "value")] == "test_value"

    assert ("extras", ) not in data

    assert errors == {}
Beispiel #5
0
    def test_convert_to_extras_output_unflattened(self):

        key = ('test_field', )
        data = {
            ('test_field', ): 'test_value',
        }
        errors = {}
        context = {}

        converters.convert_to_extras(key, data, errors, context)

        eq_(data[('extras', 0, 'key')], 'test_field')
        eq_(data[('extras', 0, 'value')], 'test_value')

        assert not ('extras', ) in data

        eq_(errors, {})
Beispiel #6
0
    def test_convert_to_extras_output_unflattened(self):

        key = ('test_field',)
        data = {
            ('test_field',): 'test_value',
        }
        errors = {}
        context = {}

        converters.convert_to_extras(key, data, errors, context)

        eq_(data[('extras', 0, 'key')], 'test_field')
        eq_(data[('extras', 0, 'value')], 'test_value')

        assert not ('extras',) in data

        eq_(errors, {})