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

gcivil-nyu-org / INET-Wednesday-Spring2024-Team-2 / 635

01 May 2024 07:07PM UTC coverage: 85.085% (+1.1%) from 83.958%
635

Pull #182

travis-pro

maludee
fix badges
Pull Request #182: add tests

27 of 43 new or added lines in 1 file covered. (62.79%)

441 existing lines in 6 files now uncovered.

1101 of 1294 relevant lines covered (85.09%)

1.35 hits per line

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

81.25
/users/utils.py
1
# utils.py
2

3
import boto3
2✔
4
from django.conf import settings
2✔
5
from pathlib import Path
2✔
6
import os
2✔
7

8

9
def send_email_to_admin(username, email):
2✔
UNCOV
10
    ses_client = boto3.client(
1✔
11
        "ses",
12
        # region_name=settings.AWS_SES_REGION_NAME,
13
        # aws_access_key_id=settings.AWS_ACCESS_KEY_ID,
14
        # aws_secret_access_key=settings.AWS_SECRET_ACCESS_KEY
15
        region_name="us-east-1",
16
        aws_access_key_id=os.environ.get("AWS_ACCESS_KEY_ID"),
17
        aws_secret_access_key=os.environ.get("AWS_SECRET_ACCESS_KEY"),
18
    )
19

UNCOV
20
    SUBJECT = "New Landlord Signup Notification"
1✔
21
    # BODY_TEXT = (f"A landlord with username '{username}' has signed up. Please verify their documentation and approve them.")
UNCOV
22
    BODY_TEXT = f"In rentwisenyc, a landlord with username '{username}' and email '{email}' has signed up. Please verify their documentation and approve them. Access it at url http://rent-wise-env.eba-3qbiyspq.us-east-1.elasticbeanstalk.com/admin "
1✔
UNCOV
23
    CHARSET = "UTF-8"
1✔
UNCOV
24
    response = None
1✔
25

UNCOV
26
    try:
1✔
UNCOV
27
        response = ses_client.send_email(
1✔
28
            Destination={
29
                "ToAddresses": [
30
                    "rentwisenyc@gmail.com",
31
                ],
32
            },
33
            Message={
34
                "Body": {
35
                    "Text": {
36
                        "Charset": CHARSET,
37
                        "Data": BODY_TEXT,
38
                    },
39
                },
40
                "Subject": {
41
                    "Charset": CHARSET,
42
                    "Data": SUBJECT,
43
                },
44
            },
45
            Source="rentwisenyc@gmail.com",
46
        )
47
    except Exception as e:
×
48
        print(f"Error sending email: {e}")
×
49
        response = {"Error": "Failed to send email", "Exception": str(e)}
×
50

UNCOV
51
    return response
1✔
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