Пример #1
0
	def test_process_line_with_id_in_API(self):
		test_processor = CSV_Processor("data-test-formatted.csv", "output.csv", False)
		test_processor._dest = cStringIO.StringIO()
		line = "lexcorp,Lex,2011-01-12,12345"
		columns = {'Account ID': 3, 'Created On': 2}
		test_processor._process_line(line, columns)
		self.assertEqual(test_processor._dest.getvalue(), "12345,2011-01-12,good,2011-01-12\n")
Пример #2
0
	def test_process_line_with_id_not_in_API(self):
		test_processor = CSV_Processor("data-test-formatted.csv", "output.csv", False)
		test_processor._dest = cStringIO.StringIO()
		line = "vanhalen,Eddie,1984-01-12,OU812"
		columns = {'Account ID': 3, 'Created On': 2}
		sys.stderr = cStringIO.StringIO()
		test_processor._process_line(line, columns)
		self.assertEqual(sys.stderr.getvalue(), "ID OU812 not found in API; skipped...\n")