• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DemocracyClub / WhoCanIVoteFor / cee7ee26-8d5f-44e8-97c7-5d3d76cef000

18 Apr 2026 07:33AM UTC coverage: 59.444% (-0.09%) from 59.533%
cee7ee26-8d5f-44e8-97c7-5d3d76cef000

push

circleci

web-flow
Merge pull request #2361 from DemocracyClub/controller-command-queue

Controller command queue

3 of 9 new or added lines in 4 files covered. (33.33%)

3056 of 5141 relevant lines covered (59.44%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/wcivf/lambda_handler.py
1
import json
×
2

3
import django
×
4
import sentry_sdk
×
5
from django.core.management import call_command
×
6

7

8
def handler(event, context):
×
9
    """
10
    Parameters
11
    ----------
12
    event: dict, required
13
        Either an SQS event (when invoked via the SQS event source mapping) or
14
        a direct invocation payload. SQS events wrap the command payload in
15
        Records[0].body as a JSON string.
16

17
        SQS event doc: https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html
18

19
    context: object, required
20
        Lambda Context runtime methods and attributes
21

22
        Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html
23

24
    Returns
25
    ------
26
    dict with statusCode and body
27
    """
NEW
28
    if "Records" in event:
×
NEW
29
        event = json.loads(event["Records"][0]["body"])
×
30

31
    cmd = event["command"]
×
32
    args = event.get("args", [])
×
33

34
    sentry_sdk.set_context("event", event)
×
35

36
    django.setup()
×
37

38
    print(f"Calling {cmd} with args {args}")
×
39
    call_command(cmd, *args)
×
40

41
    arg_str = " ".join(args)
×
42
    return {
×
43
        "statusCode": 200,
44
        "body": json.dumps(
45
            {
46
                "message": f"{cmd} {arg_str} completed",
47
            }
48
        ),
49
    }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc