Exemplo n.º 1
0
    def test_remove_child_resource_properties(self):
        property_map = dict(parent="child", parent2="child2")
        original_properties = dict(parent="value", parent2="value2", parent3="value3", parent4="value4")
        r = Relationship("related", property_map=property_map)
        updated_properties = r.remove_child_resource_properties(original_properties)
        self.assertNotEqual(id(updated_properties), id(original_properties))
        expected = dict(parent3="value3", parent4="value4")
        self.assertDictEqual(updated_properties, expected)

        original_properties.pop("parent2")
        updated_properties = r.remove_child_resource_properties(original_properties)
        self.assertDictEqual(updated_properties, expected)
Exemplo n.º 2
0
    def test_remove_child_resource_properties(self):
        property_map = dict(parent='child', parent2='child2')
        original_properties = dict(parent='value', parent2='value2',
                                   parent3='value3', parent4='value4')
        r = Relationship('related', property_map=property_map)
        updated_properties = r.remove_child_resource_properties(original_properties)
        self.assertNotEqual(id(updated_properties), id(original_properties))
        expected = dict(parent3='value3', parent4='value4')
        self.assertDictEqual(updated_properties, expected)

        original_properties.pop('parent2')
        updated_properties = r.remove_child_resource_properties(original_properties)
        self.assertDictEqual(updated_properties, expected)
Exemplo n.º 3
0
    def test_remove_child_resource_properties(self):
        property_map = dict(parent='child', parent2='child2')
        original_properties = dict(parent='value',
                                   parent2='value2',
                                   parent3='value3',
                                   parent4='value4')
        r = Relationship('related', property_map=property_map)
        updated_properties = r.remove_child_resource_properties(
            original_properties)
        self.assertNotEqual(id(updated_properties), id(original_properties))
        expected = dict(parent3='value3', parent4='value4')
        self.assertDictEqual(updated_properties, expected)

        original_properties.pop('parent2')
        updated_properties = r.remove_child_resource_properties(
            original_properties)
        self.assertDictEqual(updated_properties, expected)