flux-framework / flux-accounting

bank/accounting interface for the Flux resource manager
https://flux-framework.readthedocs.io/projects/flux-accounting/en/latest/index.html
GNU Lesser General Public License v3.0
3 stars 10 forks source link

`view-user`: create new `AssociationFormatter` subclass for viewing associations #527

Open cmoussa1 opened 1 day ago

cmoussa1 commented 1 day ago

Problem

The view_user() function manually defines its own print functionality for viewing information about an association in the flux-accounting database, but the Python bindings have its own formatting class that does this. It's also tedious to add new formatting features to the view_user() function.


This PR creates a new subclass of AccountingFormatter called AssociationFormatter. It has a unique error message when the user cannot be found in the association_table, but otherwise inherits the default JSON and table outputs that the AccountingFormatter class already provides. Thus, the various helper functions used to create output for the view_user() functions could be removed.

I've edited a number of tests in the testsuite that check for specific output from the view-user command, as well as added unit tests for the view_user() function.