Example #1
0
    def test_migrate(self):
        plan = Mock()
        items = [
            Item(plan, '1', 'path-1', 'new-path-1', []),
            Item(plan, '2', 'path-2', 'new-path-2', []),
            Item(plan, '3', 'path-3', 'new-path-3', []),
        ]

        # test
        batch = Batch()
        batch.items = items
        batch._migrate()

        # validate
        for i in items:
            expected_call = call(i.unit_id, i.storage_path, i.new_path)
            self.assertTrue(expected_call in plan.migrate.call_args_list)
    def test_migrate(self):
        plan = Mock()
        items = [
            Item(plan, '1', 'path-1', 'new-path-1', []),
            Item(plan, '2', 'path-2', 'new-path-2', []),
            Item(plan, '3', 'path-3', 'new-path-3', []),
        ]

        # test
        batch = Batch()
        batch.items = items
        batch._migrate()

        # validate
        for i in items:
            expected_call = call(i.unit_id, i.storage_path, i.new_path)
            self.assertIn(expected_call, plan.migrate.call_args_list)
    def test_migrate(self):
        plan = Mock()
        items = [
            Item(plan, '1', 'path-1', 'new-path-1', []),
            Item(plan, '2', 'path-2', 'new-path-2', []),
            Item(plan, '3', 'path-3', 'new-path-3', []),
        ]

        # test
        batch = Batch()
        batch.items = items
        batch._migrate()

        # validate
        self.assertEqual(
            plan.migrate.call_args_list,
            [
                call(i.unit_id, i.storage_path, i.new_path) for i in items
            ])
Example #4
0
    def test_migrate(self, unit_migrate):
        items = [
            Item(Mock(), '1', 'path-1', 'new-path-1'),
            Item(Mock(), '2', 'path-2', 'new-path-2'),
            Item(Mock(), '3', 'path-3', 'new-path-3'),
        ]
        _dict = Mock()
        _dict.itervalues.return_value = iter(items)

        # test
        batch = Batch()
        batch.items = _dict
        batch._migrate()

        # validate
        self.assertEqual(
            unit_migrate.call_args_list,
            [
                call(i.plan, i.unit_id, i.storage_path, i.new_path) for i in items
            ])