def test_getLastLinesFromFileMock(self): readCSVFile = ReadCSVFile() readCSVFile.getLastLines = MagicMock(return_value=[ '*****@*****.**', 'Andrew', 'Blair', '5678' ]) fileLines = readCSVFile.getLastLines(ENTITIES_FOLDER, "customer" + ".csv", 1) self.assertEqual( fileLines, ['*****@*****.**', 'Andrew', 'Blair', '5678'])
def test_getLastLinesFromFileFake(self): readCSVFile = ReadCSVFile() fileLines = readCSVFile.getLastLines(ENTITIES_FOLDER, "customer" + ".csv", 1, CSVFileObjectFake) self.assertEqual( fileLines, ['*****@*****.**', 'Andrew', 'Blair', '5678'])
def test_readFileDataReal(self): readCSVFile = ReadCSVFile() self.assertEqual(readCSVFile.getLastLines(ENTITIES_FOLDER,"customer" + ".csv", 1) ,['*****@*****.**', 'Matt', 'Barr', 'password'])
def test_getLastLinesFromFile(self): readCSVFile = ReadCSVFile() fileLines = readCSVFile.getLastLines(ENTITIES_FOLDER, "customer" + ".csv", 1) self.assertEqual( fileLines, ['*****@*****.**', 'Matt', 'Barr', '4321'])