Debian Codegraph @

test/common/test_entity.py

raw
1 # SPDX-License-Identifier: MPL-2.0
2
3 from test.common.classes import TestClasses
4
5 from cryptodatahub.common.entity import Entity, EntityRole, Server
6
7
8 class TestEntity(TestClasses.TestJsonBase):
9 @classmethod
10 def _get_class(cls):
11 return Entity
12
13 def test_get_items_by_role(self):
14 trust_store_owners = Entity.get_items_by_role(EntityRole.CA_TRUST_STORE_OWNER)
15 self.assertEqual(len(trust_store_owners), 7)
16 self.assertEqual(id(trust_store_owners), id(Entity.get_items_by_role(EntityRole.CA_TRUST_STORE_OWNER)))
17
18
19 class TestServer(TestClasses.TestJsonBase):
20 @classmethod
21 def _get_class(cls):
22 return Server
23
24 def test_str(self):
25 self.assertEqual(str(Server.HAPROXY.value), 'HAProxy')
26 self.assertEqual(str(Server.NGINX.value), 'NGINX (F5)')