def test_host_model_updated_timestamp(db_create_host): host = Host(account=ACCOUNT, canonical_facts={"fqdn": "fqdn"}) before_insert_commit = now() db_create_host(host) after_insert_commit = now() host.canonical_facts = {"fqdn": "ndqf"} before_update_commit = now() db.session.commit() after_update_commit = now() assert before_insert_commit < host.created_on < after_insert_commit assert before_update_commit < host.modified_on < after_update_commit
def test_host_model_updated_timestamp(db_create_host): host = Host( account=USER_IDENTITY["account_number"], canonical_facts={"fqdn": "fqdn"}, reporter="yupana", stale_timestamp=now(), ) before_insert_commit = now() db_create_host(host=host) after_insert_commit = now() host.canonical_facts = {"fqdn": "ndqf"} before_update_commit = now() db.session.commit() after_update_commit = now() assert before_insert_commit < host.created_on < after_insert_commit assert before_update_commit < host.modified_on < after_update_commit