def test_regular(self):
        context_data = MagicMock()
        attribute_product_data = MagicMock()

        target = Target(context_data, attribute_product_data)
        target.calculate_weighting = MagicMock(side_effect=[31, 21, 3])

        actual = target.change_entities_weighting([{"id": 1}, {"id": 2}])

        self.assertListEqual([{"id": 1, "weighting": 31}, {"id": 2, "weighting": 21}], actual)
Ejemplo n.º 2
0
    def test_regular(self):
        context_data = MagicMock()
        attribute_product_data = MagicMock()

        target = Target(context_data, attribute_product_data)
        target.calculate_weighting = MagicMock(side_effect=[31, 21, 3])

        actual = target.change_entities_weighting([{"id": 1}, {"id": 2}])

        self.assertListEqual([{
            'id': 1,
            'weighting': 31
        }, {
            'id': 2,
            'weighting': 21
        }], actual)