-
-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #1622 add automated tests for rpc.api.priority
- Loading branch information
1 parent
c562e92
commit f4f7a0e
Showing
1 changed file
with
32 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,32 @@ | ||
# -*- coding: utf-8 -*- | ||
# pylint: disable=attribute-defined-outside-init | ||
|
||
from xmlrpc.client import ProtocolError | ||
from tcms.rpc.tests.utils import APITestCase, APIPermissionsTestCase | ||
|
||
|
||
class TestPriorityFilter(APITestCase): | ||
"""Test Priority.filter method""" | ||
|
||
def test_filter_priority(self): | ||
priorities = self.rpc_client.Priority.filter({}) | ||
|
||
self.assertGreater(len(priorities), 0) | ||
for priority in priorities: | ||
self.assertIsNotNone(priority["id"]) | ||
self.assertIsNotNone(priority["value"]) | ||
self.assertIsNotNone(priority["is_active"]) | ||
|
||
|
||
class TestPriorityFilterPermissions(APIPermissionsTestCase): | ||
"""Test permission for Priority.filter method""" | ||
|
||
permission_label = "management.view_priority" | ||
|
||
def verify_api_with_permission(self): | ||
priorities = self.rpc_client.Priority.filter({}) | ||
self.assertGreater(len(priorities), 0) | ||
|
||
def verify_api_without_permission(self): | ||
with self.assertRaisesRegex(ProtocolError, "403 Forbidden"): | ||
self.rpc_client.Priority.filter({}) |