2020-09-11 13:33:52 -04:00
|
|
|
import unittest
|
2020-09-14 13:09:07 -04:00
|
|
|
from tests.base_test import BaseTest
|
2020-09-11 13:33:52 -04:00
|
|
|
|
|
|
|
from communicator.errors import CommError
|
|
|
|
from communicator.services.ivy_service import IvyService
|
|
|
|
|
|
|
|
|
2020-09-14 13:09:07 -04:00
|
|
|
class IvyServiceTest(BaseTest):
|
2020-09-11 13:33:52 -04:00
|
|
|
|
|
|
|
def test_read_file_and_build_records(self):
|
2020-09-14 13:09:07 -04:00
|
|
|
records = IvyService.samples_from_ivy_file('../data/results.csv')
|
2020-09-11 13:33:52 -04:00
|
|
|
self.assertEquals("987654321", records[0].student_id)
|
|
|
|
self.assertEquals("testpositive@virginia.edu", records[1].email)
|
|
|
|
self.assertEquals("1142270225", records[2].result_code)
|
|
|
|
|
|
|
|
def test_invalid_file(self):
|
|
|
|
with self.assertRaises(CommError):
|
2020-09-14 13:09:07 -04:00
|
|
|
IvyService.samples_from_ivy_file('../data/incorrect.csv')
|
2020-09-11 13:33:52 -04:00
|
|
|
|