-
-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for tcms.rpc.api.attachment . Fix #1619
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |