class TestPackageManagers(unittest.TestCase):
    def setUp(self):
        if os.environ.get('TRAVIS') == None:
            self.pm = PackageManagers()
            self.db = DBConnector()
            self.config = Config()

    def test_update_package_manager_data(self):
        if os.environ.get('TRAVIS') == None:
            res = self.pm.update_package_manager_data(
                self.config.package_manager_urls)
            self.assertTrue(isinstance(res, PackageManagerData))
            res = self.db.delete_data(res.id, 'package_manager_data')
            self.assertTrue(res)
class TestPackageManagers(unittest.TestCase):
    def setUp(self):
        if os.environ.get('TRAVIS') == None:
            self.pm = PackageManagers()
            self.db = DBConnector()
            self.config = Config()

    def test_update_package_manager_data(self):
        if os.environ.get('TRAVIS') == None:
            res = self.pm.update_package_manager_data(
                self.config.package_manager_urls)
            self.assertTrue(isinstance(res, PackageManagerData))
            res = self.db.delete_data(res.id, 'package_manager_data')
            self.assertTrue(res)
 def setUp(self):
     if os.environ.get('TRAVIS') == None:
         self.pm = PackageManagers()
         self.db = DBConnector()
         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)
 def setUp(self):
     if os.environ.get('TRAVIS') == None:
         self.pm = PackageManagers()
         self.db = DBConnector()
         self.config = Config()
Ejemplo n.º 6
0
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