Exemplo n.º 1
0
    def test_set_value_not_a_dict(self):
        resource = Mock()
        resource.from_dict = Mock()
        f = FieldEmbeddedResource('test', resource)

        with assert_raises(FieldValueException):
            f.set_value(['array', 'value'])

        assert_false(resource.from_dict.called)
Exemplo n.º 2
0
    def test_set_value(self):
        resource = Mock()
        resource.from_dict = Mock()
        f = FieldEmbeddedResource('test', resource)

        val = {'test': None}
        f.set_value(val)

        resource.from_dict.assert_called_once_with(val)
Exemplo n.º 3
0
    def test_set_value(self):
        resource = Mock()
        resource.from_dict = Mock()
        f = FieldEmbeddedResource('test', resource)

        val = {'test': None}
        f.set_value(val)

        resource.from_dict.assert_called_once_with(val)
Exemplo n.º 4
0
    def test_set_value_not_a_dict(self):
        resource = Mock()
        resource.from_dict = Mock()
        f = FieldEmbeddedResource('test', resource)

        with assert_raises(FieldValueException):
            f.set_value(['array', 'value'])

        assert_false(resource.from_dict.called)

    # TODO: Add some nested embedded resource tests