コード例 #1
0
class MeetingUpdateActionPerformTester(BaseMeetingUpdateActionTester):
    def setUp(self) -> None:
        super().setUp()
        self.action = MeetingUpdate(PermissionTestAdapter(),
                                    DatabaseTestAdapter())
        self.user_id = (
            7121641734  # This user has perm MEETING_CAN_MANAGE for some committees.
        )

    def test_perform_correct_1(self) -> None:
        write_request_elements = self.action.perform(self.valid_payload_1,
                                                     user_id=self.user_id)
        expected = [
            {
                "events": [
                    {
                        "type": "update",
                        "fqid": get_fqid("meeting/7816466305"),
                        "fields": {
                            "name": "name_GeiduDohx0"
                        },
                    },
                ],
                "information": {
                    get_fqid("meeting/7816466305"): ["Object updated"]
                },
                "user_id":
                self.user_id,
                "locked_fields": {
                    get_fqfield("meeting/7816466305/deleted"): 1
                },
            },
        ]
        result = list(write_request_elements)
        self.assertEqual(result, expected)
コード例 #2
0
class MeetingUpdateActionPerformTester(BaseMeetingUpdateActionTester):
    def setUp(self) -> None:
        super().setUp()
        self.user_id = 7121641734
        self.action = MeetingUpdate(
            "meeting.update",
            PermissionTestAdapter(superuser=self.user_id),
            DatabaseTestAdapter(datastore_content=self.datastore_content),
        )

    def test_perform_correct_1(self) -> None:
        write_request_elements = self.action.perform(self.valid_payload_1,
                                                     user_id=self.user_id)
        expected = [
            {
                "events": [
                    {
                        "type": "update",
                        "fqid": get_fqid("meeting/7816466305"),
                        "fields": {
                            "name": "name_GeiduDohx0"
                        },
                    },
                ],
                "information": {
                    get_fqid("meeting/7816466305"): ["Object updated"]
                },
                "user_id":
                self.user_id,
            },
        ]
        result = list(write_request_elements)
        self.assertEqual(result, expected)