def test_enable_all_accounts(self):
     bulk_enable_accounts([
         'TEST_ACCOUNT1', 'TEST_ACCOUNT2', 'TEST_ACCOUNT3', 'TEST_ACCOUNT4'
     ])
     accounts = Account.query.all()
     for account in accounts:
         self.assertTrue(account.active)
 def test_enable_bad_accounts(self):
     bulk_enable_accounts(['BAD_ACCOUNT'])
     accounts = Account.query.all()
     for account in accounts:
         if account.name == 'TEST_ACCOUNT1' or account.name == 'TEST_ACCOUNT2':
             self.assertTrue(account.active)
         else:
             self.assertFalse(account.active)
 def test_enable_one_accounts(self):
     bulk_enable_accounts(['TEST_ACCOUNT3'])
     accounts = Account.query.all()
     for account in accounts:
         if account.name != 'TEST_ACCOUNT4':
             self.assertTrue(account.active)
         else:
             self.assertFalse(account.active)
Esempio n. 4
0
def enable_accounts(accounts):
    """ Bulk enables one or more accounts """
    try:
        account_names = _parse_accounts(accounts)
    except KeyError as e:
        app.logger.error("The passed in account: {} does not exist in Security Monkey's database.".format(e.message))
        return -1

    bulk_enable_accounts(account_names)
def enable_accounts(accounts):
    """ Bulk enables one or more accounts """
    try:
        account_names = _parse_accounts(accounts)
    except KeyError as e:
        app.logger.error("The passed in account: {} does not exist in Security Monkey's database.".format(e.message))
        return -1

    bulk_enable_accounts(account_names)