mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Munge stuff into a consistent event data type
We store our audit history in two ways: 1. A list of versions of a service 2. A list of events to do with API keys In the future there could be auditing data which we want to display that is stored in other formats (for example the event table). This commit adds some objects which wrap around the different types of auditing data, and expose a consistent interface to them. This architecture will let us: - write clean code in the presentation layer to display these events on a page - add more types of events in the future by subclassing the `Event` data type, without having to rewrite anything in the presentation layer
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
from tests.conftest import SERVICE_ONE_ID
|
||||
from tests.conftest import SERVICE_ONE_ID, normalize_spaces
|
||||
|
||||
|
||||
def test_history(
|
||||
client_request,
|
||||
mock_get_service_history,
|
||||
):
|
||||
client_request.get('main.history', service_id=SERVICE_ONE_ID)
|
||||
page = client_request.get('main.history', service_id=SERVICE_ONE_ID)
|
||||
|
||||
assert normalize_spaces(
|
||||
page.select_one('main').text
|
||||
) == (
|
||||
'Service and API key history '
|
||||
'11 November at 12:12pm 6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'
|
||||
' Revoked the ‘Bad key’ API key '
|
||||
'11 November at 11:11am 6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'
|
||||
' Created an API key called ‘Bad key’ '
|
||||
'10 October at 11:10am 6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'
|
||||
' Created an API key called ‘Good key’ '
|
||||
'10 October at 11:10am 6ce466d0-fd6a-11e5-82f5-e0accb9d11a6'
|
||||
' Created this service and called it ‘Example service’'
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user