from unittest import TestCase

from ocyan.plugin.oscar_communications.order_extension.spooler_compat import spool


class SynchronousSpoolTests(TestCase):
    def test_fallback_exposes_spool_method_with_keyword_arguments(self):
        received = []

        @spool
        def task(arguments):
            received.append(arguments)
            return "done"

        self.assertEqual(task.spool(order_id="42"), "done")
        self.assertEqual(received, [{"order_id": "42"}])
