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