def test_should_populate_error_when_label_defined_in_single_explict_language(self):
     with patch('datawinners.blue.xform_bridge.parse_file_to_json') as get_xform_dict:
         xls_form_parser = XlsFormParser('some_path', 'questionnaire_name')
         fields = {'children': [{u'bind': {u'required': u'yes'}, u'type': u'text', u'name': u'name',
                                 u'label': {u'english': u'1. What is your name?'}},
                                {u'bind': {u'required': u'yes'}, u'type': u'integer', u'name': u'age',
                                 u'label': {u'english': u'2. What is your age?'}},
                                {u'bind': {u'required': u'yes'}, u'type': u'text', u'name': u'new_loc',
                                 u'label': {u'english': u'1. What is your new loc?'}},
                                {'control': {'bodyless': True}, 'type': 'group', 'name': 'meta', 'children': [
                                    {'bind': {'readonly': 'true()', 'calculate': "concat('uuid:', uuid())"},
                                     'type': 'calculate', 'name': 'instanceID'}]}]}
         get_xform_dict.return_value = fields
         actual_errors = xls_form_parser._validate_fields_are_recognised(fields['children'])
         self.assertEquals(actual_errors, {"XLSForm language settings."})
    def test_xform_validation_for_nested_repeats_names(self):
        with patch('datawinners.blue.xform_bridge.parse_file_to_json') as get_xform_dict:
            xls_form_parser = XlsFormParser('some_path', 'questionnaire_name')
            fields = {
                'children': [{u'bind': {u'required': u'yes'}, u'type': u'text', u'name': u'name', u'label': u'Name'},
                             {u'children': [{u'children': [
                                 {u'bind': {u'required': u'no'}, u'type': u'text', u'name': u'college',
                                  u'label': u'College Name'}],
                                             u'type': u'repeat', u'name': u'some', u'label': u'some'}],
                              u'type': u'repeat',
                              u'name': u'highest_degree', u'label': u'degree'},
                             {'control': {'bodyless': True}, 'type': 'group', 'name': 'meta', 'children': [
                                 {'bind': {'readonly': 'true()', 'calculate': "concat('uuid:', uuid())"},
                                  'type': 'calculate',
                                  'name': 'instanceID'}]}]}
            get_xform_dict.return_value = fields
            actual_errors = xls_form_parser._validate_fields_are_recognised(fields['children'])

            self.assertEqual(actual_errors, {"more than one level of repeated questions."})