openfga / roadmap

OpenFGA Public Roadmap
2 stars 0 forks source link

Report Code Coverage in Model Tests #44

Open aaguiarz opened 5 months ago

aaguiarz commented 5 months ago

We can display the relations that were not checked directly in tests, directly or indirectly, and report if there were tests for which the relation returned allowed = true, and allowed = false, as tests should cover both.

For example, for the tests below:

model: |
  model 
    schema 1.1

  type user
  type document
    relations
      define viewer : [user]
      define writer : [user]
      define can_view : viewer or writer
      define can_edit: writer

tuples:
  - user: user:anne
    relation: viewer
    object: document:1

tests:
    - check:
        - user : user:anne
          object : document:1
          assertions:
            can_view : true

We could report that the relation can_edit and writer were not covered at all, and the viewer, can_view were only tested for positive results.