def test_read_csv(self, mock_download): m = mock_open(read_data='a , b, c \nd,e,f') with patch("__builtin__.open", m, create=True): fieldnames, data = update_ipeds.read_csv('mockfile.csv') self.assertTrue(mock_download.call_count == 1) self.assertTrue(m.call_count == 1) self.assertTrue(fieldnames == ['a ', ' b', ' c ']) self.assertTrue(data == [{'a ': 'd', ' b': 'e', ' c ': 'f'}])
def test_read_csv(self, mock_download): m = mock_open(read_data='a , b, c \nd,e,f') with patch("builtins.open", m): fieldnames, data = update_ipeds.read_csv('mockfile.csv') self.assertEqual(mock_download.call_count, 1) self.assertEqual(m.call_count, 1)