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

DemocracyClub / WhoCanIVoteFor / 48883303-568a-4486-95cf-7248a18c5ff9

17 Apr 2026 02:50PM UTC coverage: 59.51% (-0.02%) from 59.533%
48883303-568a-4486-95cf-7248a18c5ff9

Pull #2361

circleci

symroe
Update handler to accept SQS records
Pull Request #2361: Controller command queue

0 of 2 new or added lines in 1 file covered. (0.0%)

53 existing lines in 2 files now uncovered.

3060 of 5142 relevant lines covered (59.51%)

0.6 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