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

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

24 Apr 2024 12:36AM UTC coverage: 88.975% (+2.2%) from 86.788%
603

cron

travis-pro

web-flow
Merge pull request #163 from gcivil-nyu-org/develop

Merging into master from DEV

199 of 235 new or added lines in 7 files covered. (84.68%)

58 existing lines in 3 files now uncovered.

1033 of 1161 relevant lines covered (88.98%)

0.89 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
1✔
4
from django.conf import settings
1✔
5
from pathlib import Path
1✔
6
import os
1✔
7

8

9
def send_email_to_admin(username):
1✔
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

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.")
1✔
22
    CHARSET = "UTF-8"
1✔
23
    response = None
1✔
24
    
25
    try:
1✔
26
        response = ses_client.send_email(
1✔
27
            Destination={
28
                'ToAddresses': [
29
                    'rentwisenyc@gmail.com',
30
                ],
31
            },
32
            Message={
33
                'Body': {
34
                    'Text': {
35
                        'Charset': CHARSET,
36
                        'Data': BODY_TEXT,
37
                    },
38
                },
39
                'Subject': {
40
                    'Charset': CHARSET,
41
                    'Data': SUBJECT,
42
                },
43
            },
44
            Source='rentwisenyc@gmail.com',
45
        )
NEW
46
    except Exception as e:
×
NEW
47
        print(f"Error sending email: {e}")
×
NEW
48
        response = {"Error": "Failed to send email", "Exception": str(e)}
×
49

50
    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