mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 17:31:14 -05:00
more
This commit is contained in:
@@ -34,7 +34,9 @@ def test_save_api_key_should_create_new_api_key_and_history(sample_service):
|
||||
assert all_api_keys[0] == api_key
|
||||
assert api_key.version == 1
|
||||
|
||||
all_history = api_key.get_history_model().query.all()
|
||||
all_history = (
|
||||
db.session.execute(select(api_key.get_history_model())).scalars().all()
|
||||
)
|
||||
assert len(all_history) == 1
|
||||
assert all_history[0].id == api_key.id
|
||||
assert all_history[0].version == api_key.version
|
||||
@@ -51,7 +53,9 @@ def test_expire_api_key_should_update_the_api_key_and_create_history_record(
|
||||
assert all_api_keys[0].id == sample_api_key.id
|
||||
assert all_api_keys[0].service_id == sample_api_key.service_id
|
||||
|
||||
all_history = sample_api_key.get_history_model().query.all()
|
||||
all_history = (
|
||||
db.session.execute(select(sample_api_key.get_history_model())).scalars().all()
|
||||
)
|
||||
assert len(all_history) == 2
|
||||
assert all_history[0].id == sample_api_key.id
|
||||
assert all_history[1].id == sample_api_key.id
|
||||
@@ -123,7 +127,7 @@ def test_save_api_key_can_create_key_with_same_name_if_other_is_expired(sample_s
|
||||
}
|
||||
)
|
||||
save_model_api_key(api_key)
|
||||
keys = ApiKey.query.all()
|
||||
keys = db.session.execute(select(ApiKey)).scalars().all()
|
||||
assert len(keys) == 2
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user