Пример #1
0
def visualize_student_attestations(request, registration_id):
    student = student_mdl.find_by_registration_id(registration_id)
    json_message = _make_registration_json_message(student.registration_id)
    attestation_statuses_json_dict = student_attestation_status.fetch_json_attestation_statuses(
        json_message)
    data = _make_attestation_data(attestation_statuses_json_dict, student)
    return layout.render(request, "attestation_home_admin.html", data)
 def test_fetch_with_results(self, mock_client_call):
     mock_client_call.return_value = self._get_test_attestation_statuses_as_byte(
     )
     attestation_statuses = std_att_stat.fetch_json_attestation_statuses(
         self.json_message)
     attesatation_statuses_expected = self._get_test_attestation_statuses_as_dict(
     )
     self.assertDictEqual(attesatation_statuses_expected,
                          attestation_statuses)
Пример #3
0
def home(request):
    try:
        student = student_mdl.find_by_user(request.user)
    except MultipleObjectsReturned:
        logger.exception('User {} returned multiple students.'.format(request.user.username))
        return dash_main_view.show_multiple_registration_id_error(request)
    if student:
        json_message = _make_registration_json_message(student.registration_id)
        attestation_statuses_json_dict = student_attestation_status.fetch_json_attestation_statuses(json_message)
    else:
        attestation_statuses_json_dict = None
    data = _make_attestation_data(attestation_statuses_json_dict, student)
    return layout.render(request, "attestation_home_student.html", data)
 def test_fetch_without_result(self, mock_client_call):
     mock_client_call.return_value = None
     attestation_statuses = std_att_stat.fetch_json_attestation_statuses(
         self.json_message)
     self.assertIsNone(attestation_statuses)
 def test_fetch_with_message_none(self):
     attestation_statuses = std_att_stat.fetch_json_attestation_statuses(
         None)
     self.assertIsNone(attestation_statuses)