def test_attributes_are_correctly_set(self): service = Service( self.fixture, content_loader.get_builder('g-cloud-6', 'display_service')) self.assertEquals(service.attributes[0]['name'], 'Support') self.assertEquals(len(service.attributes), 30) self.assertEquals(len(list(service.attributes[0]['rows'])), 5)
def test_the_support_attribute_group_is_not_there_if_no_attributes(self): del self.fixture['openStandardsSupported'] service = Service( self.fixture, content_loader.get_builder('g-cloud-6', 'display_service')) for group in service.attributes: if group['name'] == 'Open standards': self.fail("Support group should not be found")
def test_only_attributes_with_a_valid_type_are_added_to_groups(self): invalidValue = ('Manuals provided', 'CMS training') self.fixture['onboardingGuidance'] = invalidValue service = Service(self.fixture, content_loader.get_builder('g-cloud-6', 'display_service')) for group in service.attributes: if ( (group['name'] == 'External interface protection') and ('onboardingGuidance' in group) ): self.fail("Attribute with tuple value should not be in group")
def test_attributes_with_assurance_for_a_list_value_has_a_caveat(self): service = Service(self.fixture, content_loader.get_builder('g-cloud-6', 'display_service')) for group in service.attributes: if group['name'] == 'Asset protection and resilience': for row in group['rows']: # list with bespoke assurance caveat if row.label == 'Data management location': self.assertIn( 'independent validation of assertion', row.assurance )
def test_attributes_with_assurance_in_the_fields_add_it_correctly(self): service = Service( self.fixture, content_loader.get_builder('g-cloud-6', 'display_service')) for group in service.attributes: if group['name'] == 'Data-in-transit protection': for row in group['rows']: # string with bespoke assurance caveat if row.label == 'Data protection between services': self.assertEqual(row.value, [u'No encryption']) self.assertEqual( row.assurance, u'independent validation of assertion') # string with standard assurance caveat if row.label == 'Data protection within service': self.assertEqual(row.value, [u'No encryption'])
def test_Service_works_if_serviceBenefits_is_not_set(self): del self.fixture['serviceBenefits'] self.service = Service(self.fixture, content_loader.get_builder('g-cloud-6', 'display_service')) self.assertFalse(hasattr(self.service, 'benefits'))
def setUp(self): self.fixture = _get_fixture_data() self.fixture = self.fixture['services'] self.service = Service( self.fixture, content_loader.get_builder('g-cloud-6', 'display_service') )