|
1 | | -import asyncio |
2 | | -import time |
3 | 1 | import json |
4 | 2 | import sqlite3 |
5 | 3 | from copy import deepcopy |
@@ -673,48 +671,6 @@ def test_deletion_access_control(access_control_test_context_factory): |
673 | 671 | alice_client[top]["data_H"].delete(external_only=False) |
674 | 672 |
|
675 | 673 |
|
676 | | -async def coro_test(c, keys): |
677 | | - asyncio.sleep(0.5) |
678 | | - child_node = await c.context.http_client.app.state.root_tree[keys[0]].lookup_adapter( |
679 | | - [keys[1]] |
680 | | - ) |
681 | | - return child_node |
682 | | - |
683 | | - |
684 | | -def test_created_and_updated_info(access_control_test_context_factory): |
685 | | - """ |
686 | | - Test that created_by and updated_by fields are correctly set |
687 | | - on node creation and metadata update. |
688 | | - """ |
689 | | - |
690 | | - alice_client = access_control_test_context_factory("alice", "alice") |
691 | | - chris_client = access_control_test_context_factory("chris", "chris") |
692 | | - |
693 | | - top = "foo" |
694 | | - for data in ["data_M"]: |
695 | | - # Create a new node and check created_by and updated_by |
696 | | - chris_client[top].write_array( |
697 | | - arr, |
698 | | - key=data, |
699 | | - metadata={"description": "initial"}, |
700 | | - access_tags=["chris_tag"], |
701 | | - ) |
702 | | - coro_obj = coro_test(chris_client, [top, data]) |
703 | | - result = asyncio.run(coro_obj) |
704 | | - assert result.node.created_by == "alice" |
705 | | - assert result.node.updated_by == "alice" |
706 | | - assert result.node.time_created.date() == result.node.time_updated.date() |
707 | | - |
708 | | - time.sleep(1) # ensure time_updated is different |
709 | | - alice_client[top][data].replace_metadata( |
710 | | - metadata={"description": "updated"} |
711 | | - ) # Still need to test this works with another user |
712 | | - coro_obj = coro_test(alice_client, [top, data]) |
713 | | - result = asyncio.run(coro_obj) |
714 | | - assert result.node.created_by != result.node.updated_by |
715 | | - assert result.node.time_created != result.node.time_updated |
716 | | - |
717 | | - |
718 | 674 | def test_user_owned_node_access_control(access_control_test_context_factory): |
719 | 675 | """ |
720 | 676 | Test that user-owned nodes (i.e. nodes created without access tags applied) |
|
0 commit comments