Пример #1
0
class TestCsvWriterFactory(unittest.TestCase):
    def setUp(self):
        self.csv_writer_factory = CsvWriterFactory()

    @mock.patch('xcrawler.files.writers.csv_writer.csv.writer')
    def test_csv_writer(self, mock_csv_writer_class):
        mock_opened_file = mock.Mock()
        mock_csv_writer = mock.create_autospec(csv.writer).return_value
        mock_csv_writer_class.return_value = mock_csv_writer
        result = self.csv_writer_factory.create_csv_writer(mock_opened_file)
        self.assertEquals(result, mock_csv_writer)
Пример #2
0
class TestCsvWriterFactory(unittest.TestCase):

    def setUp(self):
        self.csv_writer_factory = CsvWriterFactory()

    @mock.patch('xcrawler.files.writers.csv_writer.csv.writer')
    def test_csv_writer(self, mock_csv_writer_class):
        mock_opened_file = mock.Mock()
        mock_csv_writer = mock.create_autospec(csv.writer).return_value
        mock_csv_writer_class.return_value = mock_csv_writer
        result = self.csv_writer_factory.create_csv_writer(mock_opened_file)
        self.assertEquals(result, mock_csv_writer)
Пример #3
0
 def __init__(self,
              file_opener=CompatibleWriteOpener(),
              object_converter=CompatibleObjectConverter(),
              variables_sorter=VariablesSorter(),
              instance_resolver=InstanceResolver(),
              csv_writer_factory=CsvWriterFactory()):
     self.file_opener = file_opener
     self.object_converter = object_converter
     self.variables_sorter = variables_sorter
     self.instance_resolver = instance_resolver
     self.csv_writer_factory = csv_writer_factory
     self.writer = None
Пример #4
0
 def setUp(self):
     self.csv_writer_factory = CsvWriterFactory()
Пример #5
0
 def setUp(self):
     self.csv_writer_factory = CsvWriterFactory()