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 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), )
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)
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)
class MeetingUpdateActionUnitTester(BaseMeetingUpdateActionTester): def setUp(self) -> None: super().setUp() self.action = MeetingUpdate(PermissionTestAdapter(), DatabaseTestAdapter()) self.action.user_id = ( 7121641734 # This user has perm MEETING_CAN_MANAGE for some committees. ) def test_validation_correct_1(self) -> None: self.action.validate(self.valid_payload_1) def test_prepare_dataset_1(self) -> None: dataset = self.action.prepare_dataset(self.valid_payload_1) self.assertEqual(dataset["position"], 1) self.assertEqual( dataset["data"], [{ "instance": self.valid_payload_1[0], "relations": {} }], )
class MeetingUpdateActionUnitTester(BaseMeetingUpdateActionTester): def setUp(self) -> None: super().setUp() user_id = 7121641734 self.action = MeetingUpdate( "meeting.update", PermissionTestAdapter(superuser=user_id), DatabaseTestAdapter(datastore_content=self.datastore_content), ) self.action.user_id = user_id def test_validation_correct_1(self) -> None: self.action.validate(self.valid_payload_1) def test_prepare_dataset_1(self) -> None: dataset = self.action.prepare_dataset(self.valid_payload_1) self.assertEqual( dataset["data"], [{ "instance": self.valid_payload_1[0], "relations": {} }], )