예제 #1
0
 def _get_rows(self, section, service_data):
     return list(
         filter(not_empty, [
             Attribute(value=service_data.get(question['id'], None),
                       question_type=question['type'],
                       label=question['question'])
             for question in section['questions']
         ]))
예제 #2
0
 def test_an_attribute_with_assurance_being_service_provider_assertion(
         self):
     attribute = Attribute(
         {
             'value': 'Managed email service',
             'assurance': 'Service provider assertion'
         }, 'text')
     self.assertEqual(attribute.value, 'Managed email service')
     self.assertEqual(attribute.assurance, False)
예제 #3
0
 def test_rendering_of_list_with_assurance(self):
     attribute = Attribute(
         {
             "value": ['Gold certification', 'Silver certification'],
             "assurance": "CESG-assured componenents"
         }, 'list')
     self.assertEqual(attribute.value,
                      ['Gold certification', 'Silver certification'])
     self.assertEqual(attribute.assurance, "CESG-assured componenents")
예제 #4
0
 def test_an_attribute_with_assurance_being_service_provider_assertion(self):
     attribute = Attribute(
         {
             'value': 'Managed email service',
             'assurance': 'Service provider assertion'
         },
         'text'
     )
     assert attribute.value == 'Managed email service'
     assert attribute.assurance is False
예제 #5
0
 def test_an_attribute_with_assurance(self):
     attribute = Attribute(
         {
             'value': 'Managed email service',
             'assurance': 'CESG-assured components'
         },
         'text'
     )
     assert attribute.value == 'Managed email service'
     assert attribute.assurance == 'CESG-assured components'
예제 #6
0
 def test_get_data_type_handles_empty_data(self):
     self.assertEqual(Attribute('', 'text').type, 'text')
     self.assertEqual(Attribute('', 'text').value, '')
     self.assertEqual(Attribute(None, 'number').type, 'text')
     self.assertEqual(Attribute(None, 'number').value, '')
     self.assertEqual(Attribute([], 'list').type, 'text')
     self.assertEqual(Attribute([], 'text').value, '')
예제 #7
0
    def test_get_data_type_handles_empty_data(self):
        assert Attribute('', 'text').type == 'text'
        assert Attribute('', 'text').value == ''

        assert Attribute(None, 'number').type == 'text'
        assert Attribute(None, 'number').value == ''

        assert Attribute([], 'list').type == 'text'
        assert Attribute([], 'text').value == ''
예제 #8
0
 def test_a_optional_attribute_with_a_value(self):
     attribute = Attribute('Managed email service', 'text', optional=True)
     self.assertEqual(attribute.answer_required, False)
예제 #9
0
 def test_get_data_value_retrieves_correct_value(self):
     self.assertEqual(
         Attribute('24/7, 365 days a year', 'text').value,
         '24/7, 365 days a year')
예제 #10
0
 def test_a_optional_attribute_with_no_value(self):
     attribute = Attribute('', 'text', optional=True)
     self.assertEqual(attribute.answer_required, False)
예제 #11
0
 def test_get_data_value_retrieves_correct_value(self):
     assert Attribute('24/7, 365 days a year', 'text').value == '24/7, 365 days a year'