예제 #1
0
    def test_replace(self, vector_client):
        vector_client.replace.side_effect = lambda id, **attributes: {
            'data': dict(id=id, attributes=attributes)
        }

        attributes = dict(name='name',
                          title='title',
                          description='description',
                          owners=['owners'],
                          readers=['readers'],
                          writers=None)

        fc = FeatureCollection('foo', vector_client=vector_client)
        fc.replace(**attributes)

        vector_client.replace.assert_called_once_with('foo', **attributes)

        for key in attributes.keys():
            self.assertEqual(getattr(fc, key), attributes[key])
예제 #2
0
    def test_replace(self, vector_client):
        vector_client.replace_product.side_effect = lambda id, **attributes: {
            "data": dict(id=id, attributes=attributes)
        }

        attributes = dict(
            name="name",
            title="title",
            description="description",
            owners=["owners"],
            readers=["readers"],
            writers=None,
        )

        attributes.pop("name")  # name is deprecated
        fc = FeatureCollection("foo", vector_client=vector_client)
        fc.replace(**attributes)

        vector_client.replace_product.assert_called_once_with(
            "foo", **attributes)

        for key in attributes.keys():
            assert getattr(fc, key) == attributes[key]