def test_LOS_with_filters(self):
        testParam = {'asmtGrade': '03', 'gender': ['male'], 'stateCode': 'NC', 'districtId': '228', 'schoolId': '242'}
        results = get_list_of_students_report(testParam)
        self.assertEqual(len(results['assessments']), 2)

        testParam['gender'] = ['not_stated']
        results = get_list_of_students_report(testParam)
        self.assertEqual(len(results['assessments']), 2)
    def test_assessments(self):
        testParam = {}
        testParam['districtId'] = '228'
        testParam['schoolId'] = '242'
        testParam['asmtGrade'] = '03'
        testParam['stateCode'] = 'NC'
        testParam['asmtSubject'] = ['ELA', 'Math']
        results = get_list_of_students_report(testParam)

        self.assertTrue('cutpoints' in results['metadata'], "returning JSON must have metadata")
        self.assertTrue('assessments' in results, "returning JSON must have assessments")

        cutpoints = results['metadata']['cutpoints']
        self.assertEqual(2, len(cutpoints), "cutpoints are ELA and MATH")
        self.assertTrue('subject2' in cutpoints, 'subject2')
        self.assertTrue('subject1' in cutpoints, 'subject1')

        claims = results['metadata']['claims']
        self.assertEqual(2, len(claims), "cutpoints are ELA and MATH")
        self.assertTrue('subject2' in claims)
        self.assertTrue('subject1' in claims)

        assessments = results['assessments']
        self.assertEqual(2, len(assessments), "2 assessments")
        student1 = assessments['Interim Comprehensive']['f9da4c5d-dc65-42d0-a36f-5d13ba930c50'][0]['20160206']
        student2 = assessments['Interim Comprehensive']['e2f3c6a5-e28b-43e8-817b-fc7afed02b9b'][0]['20160108']
        student3 = assessments['Interim Comprehensive']['dae1acf4-afb0-4013-90ba-9dcde4b25621'][0]['20160108']
        self.assertEqual("Verda", student1['student_first_name'], "first_name")
        self.assertEqual("Mi-Ha", student2['student_first_name'], "first_name")
        self.assertEqual("Lettie", student3['student_first_name'], "first_name")
 def test_invalid_params(self):
     testParam = {}
     testParam['districtId'] = '228'
     testParam['schoolId'] = '242'
     testParam['asmtGrade'] = '03'
     testParam['stateCode'] = 'AA'
     testParam['asmtSubject'] = ['ELA', 'Math']
     results = get_list_of_students_report(testParam)
     self.assertIsInstance(results, HTTPForbidden)
 def test_invalid_asmt_subject(self):
     testParam = {}
     testParam['districtId'] = '228'
     testParam['schoolId'] = '242'
     testParam['asmtGrade'] = '03'
     testParam['stateCode'] = 'NC'
     testParam['asmtSubject'] = ['Dummy']
     results = get_list_of_students_report(testParam)
     self.assertEqual(len(results['assessments']), 0, "should return no results")
 def test_asmt_administration(self):
     testParam = {}
     testParam['stateCode'] = 'NC'
     testParam['districtId'] = '228'
     testParam['schoolId'] = '242'
     testParam['asmtGrade'] = '03'
     testParam['asmtSubject'] = ['ELA', 'Math']
     results = get_list_of_students_report(testParam)
     self.assertTrue('asmt_administration' in results, "asmt_administration is missing")
     self.assertEqual(len(results['asmt_administration']), 2, "should have 2 different test")
    def test_breadcrumbs(self):
        testParam = {}
        testParam['stateCode'] = 'NC'
        testParam['districtId'] = '228'
        testParam['schoolId'] = '242'
        testParam['asmtGrade'] = '03'
        testParam['asmtSubject'] = ['ELA', 'Math']
        results = get_list_of_students_report(testParam)

        self.assertTrue('context' in results, "returning JSON must have context")
    def test_Math_only(self):
        testParam = {}
        testParam['districtId'] = '228'
        testParam['schoolId'] = '242'
        testParam['asmtGrade'] = '03'
        testParam['stateCode'] = 'NC'
        testParam['asmtSubject'] = ['Math']
        results = get_list_of_students_report(testParam)

        self.assertTrue('metadata' in results, "returning JSON must have cutpoints")

        cutpoints = results['metadata']['cutpoints']
        self.assertEqual(1, len(cutpoints))
        self.assertTrue('subject1' in cutpoints, 'subject1')

        claims = results['metadata']['claims']
        self.assertEqual(1, len(claims), "claims are ELA")
        self.assertTrue('subject1' in claims, 'subject1')
 def test_asmt_type(self):
     testParam = {'asmtGrade': '03', 'stateCode': 'NC', 'districtId': '228', 'schoolId': '242', 'asmtYear': '2015'}
     results = get_list_of_students_report(testParam)
     self.assertEqual(len(results['assessments']), 2)
     self.assertEqual(len(results['assessments']['Interim Comprehensive']['cad811ad-9b08-4dd1-aa10-52360b80ff7f']), 2)