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

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

24 Apr 2024 03:39AM UTC coverage: 88.708% (+0.009%) from 88.699%
590

push

travis-pro

web-flow
Merge pull request #168 from gcivil-nyu-org/siri-updated-admin-email

updated admin email for landlord verification

1 of 3 new or added lines in 2 files covered. (33.33%)

75 existing lines in 5 files now uncovered.

1037 of 1169 relevant lines covered (88.71%)

1.71 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.")
NEW
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