def setUp(self): import tempfile if not hasattr(sys.stdout, 'getvalue'): self.fail('This test needs to be run in buffered mode') # Create a connection to check the contents of the registry self.db = Database(DB_USER, DB_PASSWORD, DB_NAME, DB_HOST, DB_PORT) # Import predefined dataset for testing self._load_test_dataset() # Temporary file for outputs self.tmpfile = tempfile.mkstemp()[1] # Create command self.kwargs = {'user' : DB_USER, 'password' : DB_PASSWORD, 'database' : DB_NAME, 'host' : DB_HOST, 'port' : DB_PORT} self.cmd = Export(**self.kwargs)
def export_identities(filename): """ Export Sortinghat identities to a file """ logger.info("[sortinghat] Exporting identities to %s", filename) code = Export(**self.sh_kwargs).run("--identities", filename) if code != CMD_SUCCESS: logger.error("[sortinghat] Error exporting %s", filename)