def test_task_params(self, task_mock):
        """Ensure the resultant task parms contain all info."""
        from sosbeacon.event.message import get_group_broadcast_task

        group_key = Mock()
        group_key.urlsafe.return_value = "AGROUPKEY"

        event_key = Mock()
        event_key.urlsafe.return_value = "SOMEEVENTKEY"

        message_key = Mock()
        message_key.urlsafe.return_value = "SOMEMESSAGEKEY"

        batch_id = "THEBATCHID"
        iteration = 19

        get_group_broadcast_task(group_key, event_key, message_key, batch_id, iteration)

        check_params = {
            "group": "AGROUPKEY",
            "event": "SOMEEVENTKEY",
            "message": "SOMEMESSAGEKEY",
            "batch": "THEBATCHID",
            "cursor": "",
            "iter": 19,
        }
        self.assertEqual(check_params, task_mock.call_args[1]["params"])
    def test_cursor(self, task_mock):
        """Ensure the resultant task parms contain the cursor."""
        from sosbeacon.event.message import get_group_broadcast_task

        group_key = Mock()
        group_key.urlsafe.return_value = "ZGROUPKEY"

        event_key = Mock()
        event_key.urlsafe.return_value = "ANEVENTKEY"

        message_key = Mock()
        message_key.urlsafe.return_value = "AMESSAGEKEY"

        cursor = Mock()
        cursor.urlsafe.return_value = "CURSOR,THE"

        batch_id = "ABATCHID"
        iteration = 33

        get_group_broadcast_task(group_key, event_key, message_key, batch_id, iteration, cursor)

        check_params = {
            "group": "ZGROUPKEY",
            "event": "ANEVENTKEY",
            "message": "AMESSAGEKEY",
            "batch": "ABATCHID",
            "cursor": "CURSOR,THE",
            "iter": 33,
        }
        self.assertEqual(check_params, task_mock.call_args[1]["params"])
    def test_task_name(self, task_mock):
        """Ensure the resultant task name contains enough to be unique."""
        from sosbeacon.event.message import get_group_broadcast_task

        group_key = Mock()
        group_key.urlsafe.return_value = "GROUPKEY"

        event_key = Mock()
        event_key.urlsafe.return_value = "EVENTKEY"

        message_key = Mock()
        message_key.urlsafe.return_value = "MESSAGEKEY"

        batch_id = "BATCHID"
        iteration = 7

        get_group_broadcast_task(group_key, event_key, message_key, batch_id, iteration)

        task_name = task_mock.call_args[1]["name"]
        self.assertIn("GROUPKEY", task_name)
        self.assertNotIn("EVENTKEY", task_name)
        self.assertIn("MESSAGEKEY", task_name)
        self.assertIn("BATCHID", task_name)
        self.assertIn("7", task_name)