Best Python code snippet using Kiwi_python
test_testplan.py
Source:test_testplan.py  
...256        file_name = 'attachment.txt'257        self.rpc_client.TestPlan.add_attachment(self.plan.pk, file_name, 'a2l3aXRjbXM=')258        attachments = self.rpc_client.TestPlan.list_attachments(self.plan.pk)259        self.assertEqual(1, len(attachments))260    def test_list_attachments_with_wrong_plan_id(self):261        with self.assertRaisesRegex(XmlRPCFault, 'TestPlan matching query does not exist'):262            self.rpc_client.TestPlan.list_attachments(-1)263class TestListAttachmentsPermissions(APIPermissionsTestCase):264    permission_label = 'attachments.view_attachment'265    def _fixture_setup(self):266        super()._fixture_setup()267        self.plan = TestPlanFactory()268    def verify_api_with_permission(self):269        attachments = self.rpc_client.TestPlan.list_attachments(self.plan.pk)270        self.assertEqual(0, len(attachments))271    def verify_api_without_permission(self):272        with self.assertRaisesRegex(ProtocolError, '403 Forbidden'):273            self.rpc_client.TestPlan.list_attachments(self.plan.pk)274class TestAddAttachmentPermissions(APIPermissionsTestCase):...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!!
