def test_accounts(self): """ Tests library, database and environment accounts. """ l = self.library() l.drop() l.create() lcsp = LibraryConfigSyncProxy(l) lcsp.sync() # db = self.library().database # for v in l.database.root_dataset.config.library: # print v l.filesystem.downloads('foo', 'bar') l.filesystem.build('foo', 'bar') for k, v in l.accounts.items(): act = l.account(k) if k in ( 'ambry', 'google_spreadsheets', ): continue if act.major_type != 'ambry': self.assertTrue(bool(act.decrypt_secret())) self.assertTrue(bool(act.account_id)) for remote in l.remotes: self.assertTrue(bool(remote.url)) os.environ['AMBRY_DB'] = l.database.dsn = 'sqlite://' os.environ['AMBRY_ACCOUNT_PASSWORD'] = l._account_password self.assertEqual(l.database.dsn, os.getenv('AMBRY_DB')) l = new_library() try: for k, v in l.accounts.items(): act = l.account(k) if k in ( 'ambry', 'google_spreadsheets', ): continue if act.major_type != 'ambry': self.assertTrue(bool(act.decrypt_secret())) self.assertTrue(bool(act.account_id)) for remote in l.remotes: self.assertTrue(bool(remote.url)) finally: l.close()
def test_accounts(self): """ Tests library, database and environment accounts. """ l = self.library() l.drop() l.create() lcsp = LibraryConfigSyncProxy(l) lcsp.sync() # db = self.library().database # for v in l.database.root_dataset.config.library: # print v l.filesystem.downloads('foo', 'bar') l.filesystem.build('foo', 'bar') for k, v in l.accounts.items(): act = l.account(k) if k in ('ambry', 'google_spreadsheets',): continue if act.major_type != 'ambry': self.assertTrue(bool(act.decrypt_secret())) self.assertTrue(bool(act.account_id)) for remote in l.remotes: self.assertTrue(bool(remote.url)) os.environ['AMBRY_DB'] = l.database.dsn = 'sqlite://' os.environ['AMBRY_ACCOUNT_PASSWORD'] = l._account_password self.assertEqual(l.database.dsn, os.getenv('AMBRY_DB')) l = new_library() try: for k, v in l.accounts.items(): act = l.account(k) if k in ('ambry', 'google_spreadsheets',): continue if act.major_type != 'ambry': self.assertTrue(bool(act.decrypt_secret())) self.assertTrue(bool(act.account_id)) for remote in l.remotes: self.assertTrue(bool(remote.url)) finally: l.close()
def create(self): from config import LibraryConfigSyncProxy self.database.create() lcsp = LibraryConfigSyncProxy(self) lcsp.sync()
def sync_config(self, force=False): """Sync the file config into the library proxy data in the root dataset """ from ambry.library.config import LibraryConfigSyncProxy lcsp = LibraryConfigSyncProxy(self) lcsp.sync(force=force)