Skip to content

Commit

Permalink
add test for tcms.rpc.api.attachment . Fix #1619
Browse files Browse the repository at this point in the history
  • Loading branch information
awalvie committed Oct 31, 2020
1 parent a0bd298 commit ed45ad7
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tcms/rpc/tests/test_attachment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# pylint: disable=attribute-defined-outside-init, invalid-name, objects-update-used

from tcms.rpc.tests.utils import APITestCase
from tcms.tests.factories import TestPlanFactory

class TestRemoveAttachment(APITestCase):
"""Test for Attachment.remove_attachment"""

def _fixture_setup(self):
super()._fixture_setup()

self.plan = TestPlanFactory()

def test_remove_attachment(self):
file_name = 'attachment.txt'

self.rpc_client.TestPlan.add_attachment(self.plan.pk, file_name, 'a2l3aXRjbXM=')
attachments = self.rpc_client.TestPlan.list_attachments(self.plan.pk)

self.rpc_client.Attachment.remove_attachment(attachments[0]['pk'])
attachments = self.rpc_client.TestPlan.list_attachments(self.plan.pk)

self.assertEqual(0, len(attachments))

0 comments on commit ed45ad7

Please sign in to comment.