class TestSendGridEmail(unittest.TestCase): def setUp(self): if os.environ.get('TRAVIS') == None: self.sg = SendGrid() self.config = Config() def test_send_email(self): if os.environ.get('TRAVIS') == None: res = self.sg.send_email('*****@*****.**', self.config.from_email, self.config.email_subject, self.config.email_body) self.assertEqual(202, res[0])
class TestSendGridEmail(unittest.TestCase): def setUp(self): if os.environ.get('TRAVIS') == None: self.sg = SendGrid() self.config = Config() def test_send_email(self): if os.environ.get('TRAVIS') == None: res = self.sg.send_email( '*****@*****.**', self.config.from_email, self.config.email_subject, self.config.email_body ) self.assertEqual(202, res[0])
def setUp(self): if os.environ.get('TRAVIS') == None: self.sg = SendGrid() self.config = Config()
from db_connector import DBConnector from config import Config from github import GitHub from package_managers import PackageManagers from sendgrid_email import SendGrid config = Config() db = DBConnector() github = GitHub() pm = PackageManagers() sg = SendGrid() # Update the DB with the GitHub repo data for repo in config.github_repos: github.update_library_data(config.github_user, repo) # Update the DB with Package Manager data pm.update_package_manager_data(config.package_manager_urls) # Send an email update sg.send_email(config.to_email, config.from_email, config.email_subject, config.email_body)
from db_connector import DBConnector, GitHubData, PackageManagerData from config import Config from github import GitHub from package_managers import PackageManagers from sendgrid_email import SendGrid config = Config() db = DBConnector() github = GitHub() pm = PackageManagers() sg = SendGrid() def update(send_email=True): # Update the DB with the GitHub repo data for repo in config.github_repos: github.update_library_data(config.github_user, repo) # Update the DB with Package Manager data pm.update_package_manager_data(config.package_manager_urls) # Export tables as CSV if config file indicates to do so if config.export_github: db.export_table_to_csv(GitHubData) if config['export_tables']['PackageManagers']: db.export_table_to_csv(PackageManagerData) if not send_email: return # Send an email update