Example #1
0
    def test_fields(self):
        f = Formatter(self.concept)

        meta = f.get_meta()
        header = meta['header']
        self.assertEqual(3, len(header))

        names = [x['name'] for x in header]
        self.assertEqual(names, ['name', 'salary', 'boss'])
Example #2
0
    def test_unique_keys(self):
        title_name = DataField.objects.get_by_natural_key(
            'tests', 'title', 'name')

        project_name = DataField.objects.get_by_natural_key(
            'tests', 'project', 'name')

        concept = DataConcept()
        concept.save()

        DataConceptField(concept=concept, field=title_name, order=1).save()
        DataConceptField(concept=concept, field=project_name, order=2).save()

        f = Formatter(concept=concept)

        meta = f.get_meta()
        names = [x['name'] for x in meta['header']]

        self.assertEqual(names, ['title__name', 'project__name'])