Best Python code snippet using localstack_python
test_rbac_types.py
Source:test_rbac_types.py
...25 valid_rule_permissions = PermissionType.get_valid_permissions_for_resource_type(26 resource_type=ResourceType.RULE)27 for name in valid_rule_permissions:28 self.assertTrue(name.startswith(ResourceType.RULE + '_'))29 def test_get_resource_type(self):30 self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_LIST),31 SystemType.PACK)32 self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_VIEW),33 SystemType.PACK)34 self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_CREATE),35 SystemType.PACK)36 self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_MODIFY),37 SystemType.PACK)38 self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_DELETE),39 SystemType.PACK)40 self.assertEqual(PermissionType.get_resource_type(PermissionType.PACK_ALL),41 SystemType.PACK)42 self.assertEqual(PermissionType.get_resource_type(PermissionType.SENSOR_LIST),43 SystemType.SENSOR_TYPE)44 self.assertEqual(PermissionType.get_resource_type(PermissionType.SENSOR_VIEW),45 SystemType.SENSOR_TYPE)46 self.assertEqual(PermissionType.get_resource_type(PermissionType.SENSOR_MODIFY),47 SystemType.SENSOR_TYPE)48 self.assertEqual(PermissionType.get_resource_type(PermissionType.SENSOR_ALL),49 SystemType.SENSOR_TYPE)50 self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_LIST),51 SystemType.ACTION)52 self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_VIEW),53 SystemType.ACTION)54 self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_CREATE),55 SystemType.ACTION)56 self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_MODIFY),57 SystemType.ACTION)58 self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_DELETE),59 SystemType.ACTION)60 self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_EXECUTE),61 SystemType.ACTION)62 self.assertEqual(PermissionType.get_resource_type(PermissionType.ACTION_ALL),63 SystemType.ACTION)64 self.assertEqual(PermissionType.get_resource_type(PermissionType.EXECUTION_LIST),65 SystemType.EXECUTION)66 self.assertEqual(PermissionType.get_resource_type(PermissionType.EXECUTION_VIEW),67 SystemType.EXECUTION)68 self.assertEqual(PermissionType.get_resource_type(PermissionType.EXECUTION_RE_RUN),69 SystemType.EXECUTION)70 self.assertEqual(PermissionType.get_resource_type(PermissionType.EXECUTION_STOP),71 SystemType.EXECUTION)72 self.assertEqual(PermissionType.get_resource_type(PermissionType.EXECUTION_ALL),73 SystemType.EXECUTION)74 self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_LIST),75 SystemType.RULE)76 self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_VIEW),77 SystemType.RULE)78 self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_CREATE),79 SystemType.RULE)80 self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_MODIFY),81 SystemType.RULE)82 self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_DELETE),83 SystemType.RULE)84 self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_ALL),85 SystemType.RULE)86 self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_ENFORCEMENT_LIST),87 SystemType.RULE_ENFORCEMENT)88 self.assertEqual(PermissionType.get_resource_type(PermissionType.RULE_ENFORCEMENT_VIEW),89 SystemType.RULE_ENFORCEMENT)90 self.assertEqual(PermissionType.get_resource_type(PermissionType.KEY_VALUE_VIEW),91 SystemType.KEY_VALUE_PAIR)92 self.assertEqual(PermissionType.get_resource_type(PermissionType.KEY_VALUE_SET),93 SystemType.KEY_VALUE_PAIR)94 self.assertEqual(PermissionType.get_resource_type(PermissionType.KEY_VALUE_DELETE),95 SystemType.KEY_VALUE_PAIR)96 self.assertEqual(PermissionType.get_resource_type(PermissionType.WEBHOOK_CREATE),97 SystemType.WEBHOOK)98 self.assertEqual(PermissionType.get_resource_type(PermissionType.WEBHOOK_SEND),99 SystemType.WEBHOOK)100 self.assertEqual(PermissionType.get_resource_type(PermissionType.WEBHOOK_DELETE),101 SystemType.WEBHOOK)102 self.assertEqual(PermissionType.get_resource_type(PermissionType.WEBHOOK_ALL),103 SystemType.WEBHOOK)104 self.assertEqual(PermissionType.get_resource_type(PermissionType.API_KEY_LIST),105 SystemType.API_KEY)106 self.assertEqual(PermissionType.get_resource_type(PermissionType.API_KEY_VIEW),107 SystemType.API_KEY)108 self.assertEqual(PermissionType.get_resource_type(PermissionType.API_KEY_CREATE),109 SystemType.API_KEY)110 self.assertEqual(PermissionType.get_resource_type(PermissionType.API_KEY_DELETE),111 SystemType.API_KEY)112 self.assertEqual(PermissionType.get_resource_type(PermissionType.API_KEY_ALL),113 SystemType.API_KEY)114 def test_get_permission_type(self):115 self.assertEqual(PermissionType.get_permission_type(resource_type=ResourceType.ACTION,116 permission_name='view'),117 PermissionType.ACTION_VIEW)118 self.assertEqual(PermissionType.get_permission_type(resource_type=ResourceType.ACTION,119 permission_name='all'),120 PermissionType.ACTION_ALL)121 self.assertEqual(PermissionType.get_permission_type(resource_type=ResourceType.ACTION,122 permission_name='execute'),123 PermissionType.ACTION_EXECUTE)124 self.assertEqual(PermissionType.get_permission_type(resource_type=ResourceType.RULE,125 permission_name='view'),126 PermissionType.RULE_VIEW)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!