Exemplo n.º 1
0
 def test_csv_formatter_foreign_key(self):
     fields = {
         'Document Number': 'document_key',
         'Leader': 'leader',
     }
     formatter = CSVFormatter(fields)
     metadata = self.docs[0].metadata
     revision = metadata.latest_revision
     revision.leader = UserFactory(name='Grand Schtroumpf')
     revision.save()
     csv = formatter.format([revision])
     expected_csv = b'{};Grand Schtroumpf\n'.format(metadata.document_key)
     self.assertEqual(csv, expected_csv)
Exemplo n.º 2
0
 def test_csv_formatter(self):
     fields = OrderedDict((
         ('Document Number', 'document_key'),
         ('Title', 'title'),
     ))
     formatter = CSVFormatter(fields)
     csv = formatter.format(self.revisions[0:2])
     expected_csv = '{};{}\n{};{}\n'.format(
         self.docs[0].document_key,
         self.docs[0].title,
         self.docs[1].document_key,
         self.docs[1].title,
     ).encode()
     self.assertEqual(csv, expected_csv)
Exemplo n.º 3
0
 def test_csv_formatter(self):
     fields = {
         'Document Number': 'document_key',
         'Title': 'title',
     }
     formatter = CSVFormatter(fields)
     csv = formatter.format(self.revisions[0:2])
     expected_csv = b'{};{}\n{};{}\n'.format(
         self.docs[0].document_key,
         self.docs[0].title,
         self.docs[1].document_key,
         self.docs[1].title,
     )
     self.assertEqual(csv, expected_csv)
Exemplo n.º 4
0
 def test_csv_formatter(self):
     fields = OrderedDict((
         ('Document Number', 'document_key'),
         ('Title', 'title'),
     ))
     formatter = CSVFormatter(fields)
     csv = formatter.format(self.revisions[0:2])
     expected_csv = '{};{}\n{};{}\n'.format(
         self.docs[0].document_key,
         self.docs[0].title,
         self.docs[1].document_key,
         self.docs[1].title,
     ).encode()
     self.assertEqual(csv, expected_csv)