コード例 #1
0
 def test_candidate_thesis_uploaded(self):
     self._create_candidate()
     add_file_to_thesis(self.candidate.thesis)
     auth_client = get_auth_client()
     response = auth_client.get(reverse('candidate_home'))
     self.assertContains(response, TEST_PDF_FILENAME)
     self.assertContains(response, reverse('candidate_upload', kwargs={'candidate_id': self.candidate.id}))
コード例 #2
0
 def test_candidate_thesis_uploaded(self):
     self._create_candidate()
     add_file_to_thesis(self.candidate.thesis)
     auth_client = get_auth_client()
     response = auth_client.get(reverse('candidate_home'))
     self.assertContains(response, 'test.pdf')
     self.assertContains(response, reverse('candidate_upload'))
コード例 #3
0
ファイル: test_views.py プロジェクト: bcail/etd_app
 def test_candidate_thesis_uploaded(self):
     self._create_candidate()
     add_file_to_thesis(self.candidate.thesis)
     auth_client = get_auth_client()
     response = auth_client.get(reverse('candidate_home'))
     self.assertContains(response, 'test.pdf')
     self.assertContains(response, reverse('candidate_upload'))
コード例 #4
0
 def test_view_file(self):
     self._create_candidate()
     add_file_to_thesis(self.candidate.thesis)
     auth_client = get_auth_client()
     response = auth_client.get(
         reverse('view_file', kwargs={'candidate_id': self.candidate.id}))
     self.assertEqual(response.status_code, 200)
コード例 #5
0
 def test_format_post(self):
     self._create_candidate()
     thesis = self.candidate.thesis
     add_file_to_thesis(thesis)
     add_metadata_to_thesis(thesis)
     self.candidate.committee_members.add(self.committee_member)
     self.candidate.thesis.submit()
     staff_client = get_staff_client()
     post_data = {
         'title_page_issue': True,
         'signature_page_issue': True,
         'signature_page_comment': 'Test comment',
         'accept_diss': 'Approve'
     }
     url = reverse('format_post',
                   kwargs={'candidate_id': self.candidate.id})
     response = staff_client.post(url, post_data)
     self.assertRedirects(
         response,
         reverse('approve', kwargs={'candidate_id': self.candidate.id}))
     self.assertEqual(
         Candidate.objects.all()
         [0].thesis.format_checklist.title_page_issue, True)
     self.assertEqual(Candidate.objects.all()[0].thesis.status,
                      Thesis.STATUS_CHOICES.accepted)
コード例 #6
0
 def test_edit_profile_locked(self):
     add_file_to_thesis(self.candidate.thesis)
     add_metadata_to_thesis(self.candidate.thesis)
     self.candidate.committee_members.add(self.committee_member)
     self.candidate.thesis.submit()
     auth_client = get_auth_client()
     data = self.person_data.copy()
     response = auth_client.post(self.url, data, follow=True)
     self.assertEqual(response.status_code, 403)
コード例 #7
0
 def test_candidate_submit(self):
     self.candidate.committee_members.add(self.committee_member)
     thesis = self.candidate.thesis
     add_file_to_thesis(thesis)
     add_metadata_to_thesis(thesis)
     auth_client = get_auth_client()
     response = auth_client.post(self.submit_url)
     self.assertRedirects(response, reverse('candidate_home', kwargs={'candidate_id': self.candidate.id}))
     self.assertEqual(Candidate.objects.all()[0].thesis.status, 'pending')
コード例 #8
0
 def test_candidate_submit(self):
     self._create_candidate()
     self.candidate.committee_members.add(self.committee_member)
     thesis = self.candidate.thesis
     add_file_to_thesis(thesis)
     add_metadata_to_thesis(thesis)
     auth_client = get_auth_client()
     response = auth_client.post(reverse('candidate_submit'))
     self.assertRedirects(response, 'http://testserver/candidate/')
     self.assertEqual(Candidate.objects.all()[0].thesis.status, 'pending')
コード例 #9
0
 def test_candidate_ready_to_submit(self):
     self._create_candidate()
     self.candidate.degree = self.masters_degree
     self.candidate.save()
     add_file_to_thesis(self.candidate.thesis)
     add_metadata_to_thesis(self.candidate.thesis)
     self.candidate.committee_members.add(self.committee_member)
     auth_client = get_auth_client()
     response = auth_client.get(reverse('candidate_home'))
     self.assertContains(response, 'Preview and Submit Thesis')
コード例 #10
0
ファイル: test_views.py プロジェクト: bcail/etd_app
 def test_candidate_submit(self):
     self._create_candidate()
     self.candidate.committee_members.add(self.committee_member)
     thesis = self.candidate.thesis
     add_file_to_thesis(thesis)
     add_metadata_to_thesis(thesis)
     auth_client = get_auth_client()
     response = auth_client.post(reverse('candidate_submit'))
     self.assertRedirects(response, 'http://testserver/candidate/')
     self.assertEqual(Candidate.objects.all()[0].thesis.status, 'pending')
コード例 #11
0
 def test_metadata_post_thesis_already_exists(self):
     auth_client = get_auth_client()
     add_file_to_thesis(self.candidate.thesis)
     self.assertEqual(len(Thesis.objects.all()), 1)
     k = Keyword.objects.create(text='tëst')
     data = {'title': 'tëst', 'abstract': 'tëst abstract', 'keywords': k.id}
     response = auth_client.post(self.url, data)
     self.assertEqual(len(Thesis.objects.all()), 1)
     thesis = Candidate.objects.all()[0].thesis
     self.assertEqual(thesis.title, 'tëst')
     self.assertEqual(thesis.original_file_name, TEST_PDF_FILENAME)
コード例 #12
0
ファイル: test_views.py プロジェクト: bcail/etd_app
 def test_candidate_ready_to_submit(self):
     self._create_candidate()
     degree2 = Degree.objects.create(abbreviation='MS', name='Masters', degree_type=Degree.TYPES.masters)
     self.candidate.degree = degree2
     self.candidate.save()
     add_file_to_thesis(self.candidate.thesis)
     add_metadata_to_thesis(self.candidate.thesis)
     self.candidate.committee_members.add(self.committee_member)
     auth_client = get_auth_client()
     response = auth_client.get(reverse('candidate_home'))
     self.assertContains(response, 'Preview and Submit Thesis')
コード例 #13
0
 def test_metadata_thesis_locked(self):
     add_file_to_thesis(self.candidate.thesis)
     add_metadata_to_thesis(self.candidate.thesis)
     self.candidate.committee_members.add(self.committee_member)
     self.candidate.thesis.submit()
     self.candidate.thesis.accept()
     auth_client = get_auth_client()
     response = auth_client.get(self.url)
     self.assertEqual(response.status_code, 403)
     response = auth_client.post(self.url)
     self.assertEqual(response.status_code, 403)
コード例 #14
0
ファイル: test_views.py プロジェクト: bcail/etd_app
 def test_candidate_preview(self):
     self._create_candidate()
     self.candidate.committee_members.add(self.committee_member)
     thesis = self.candidate.thesis
     add_file_to_thesis(thesis)
     add_metadata_to_thesis(thesis)
     auth_client = get_auth_client()
     response = auth_client.post(reverse('candidate_preview_submission'))
     self.assertContains(response, 'Preview Your Dissertation')
     self.assertContains(response, 'Name:')
     self.assertContains(response, 'Title:')
     self.assertContains(response, 'Submit Your Dissertation')
コード例 #15
0
ファイル: test_views.py プロジェクト: bcail/etd_app
 def test_view_candidates_all(self):
     self._create_candidate()
     thesis = Thesis.objects.all()[0]
     add_file_to_thesis(thesis)
     add_metadata_to_thesis(thesis)
     self.candidate.committee_members.add(self.committee_member)
     thesis.submit()
     staff_client = get_staff_client()
     response = staff_client.get(reverse('review_candidates', kwargs={'status': 'all'}))
     self.assertContains(response, '>Status</a>')
     self.assertContains(response, '%s, %s' % (LAST_NAME, FIRST_NAME))
     self.assertContains(response, 'Awaiting ')
コード例 #16
0
 def test_metadata_post_thesis_already_exists(self):
     self._create_candidate()
     auth_client = get_auth_client()
     add_file_to_thesis(self.candidate.thesis)
     self.assertEqual(len(Thesis.objects.all()), 1)
     k = Keyword.objects.create(text='tëst')
     data = {'title': 'tëst', 'abstract': 'tëst abstract', 'keywords': k.id}
     response = auth_client.post(reverse('candidate_metadata'), data)
     self.assertEqual(len(Thesis.objects.all()), 1)
     thesis = Candidate.objects.all()[0].thesis
     self.assertEqual(thesis.title, 'tëst')
     self.assertEqual(thesis.original_file_name, 'test.pdf')
コード例 #17
0
 def test_candidate_preview(self):
     self._create_candidate()
     self.candidate.committee_members.add(self.committee_member)
     thesis = self.candidate.thesis
     add_file_to_thesis(thesis)
     add_metadata_to_thesis(thesis)
     auth_client = get_auth_client()
     response = auth_client.post(reverse('candidate_preview_submission'))
     self.assertContains(response, 'Preview Your Dissertation')
     self.assertContains(response, 'Name:')
     self.assertContains(response, 'Title:')
     self.assertContains(response, 'Submit Your Dissertation')
コード例 #18
0
ファイル: test_views.py プロジェクト: bcail/etd_app
 def test_upload_thesis_locked(self):
     self._create_candidate()
     add_file_to_thesis(self.candidate.thesis)
     add_metadata_to_thesis(self.candidate.thesis)
     self.candidate.committee_members.add(self.committee_member)
     self.candidate.thesis.submit()
     self.candidate.thesis.accept()
     auth_client = get_auth_client()
     response = auth_client.get(reverse('candidate_upload'))
     self.assertEqual(response.status_code, 403)
     response = auth_client.post(reverse('candidate_upload'))
     self.assertEqual(response.status_code, 403)
コード例 #19
0
 def test_committee_members_thesis_locked(self):
     self._create_candidate()
     add_file_to_thesis(self.candidate.thesis)
     add_metadata_to_thesis(self.candidate.thesis)
     self.candidate.committee_members.add(self.committee_member)
     self.candidate.thesis.submit()
     self.candidate.thesis.accept()
     auth_client = get_auth_client()
     response = auth_client.get(reverse('candidate_committee'))
     self.assertEqual(response.status_code, 403)
     response = auth_client.post(reverse('candidate_committee'))
     self.assertEqual(response.status_code, 403)
コード例 #20
0
ファイル: test_views.py プロジェクト: bcail/etd_app
 def test_format_post_reject(self):
     self._create_candidate()
     thesis = self.candidate.thesis
     add_file_to_thesis(thesis)
     add_metadata_to_thesis(thesis)
     self.candidate.committee_members.add(self.committee_member)
     self.candidate.thesis.submit()
     staff_client = get_staff_client()
     post_data = {'title_page_issue': True, 'signature_page_issue': True, 'signature_page_comment': 'Test comment',
             'reject_diss': 'Reject'}
     url = reverse('format_post', kwargs={'candidate_id': self.candidate.id})
     response = staff_client.post(url, post_data)
     self.assertEqual(Candidate.objects.all()[0].thesis.status, Thesis.STATUS_CHOICES.rejected)
コード例 #21
0
 def test_candidate_ready_to_submit(self):
     self._create_candidate()
     degree2 = Degree.objects.create(abbreviation='MS',
                                     name='Masters',
                                     degree_type=Degree.TYPES.masters)
     self.candidate.degree = degree2
     self.candidate.save()
     add_file_to_thesis(self.candidate.thesis)
     add_metadata_to_thesis(self.candidate.thesis)
     self.candidate.committee_members.add(self.committee_member)
     auth_client = get_auth_client()
     response = auth_client.get(reverse('candidate_home'))
     self.assertContains(response, 'Preview and Submit Thesis')
コード例 #22
0
 def test_view_candidates_all(self):
     self._create_candidate()
     thesis = Thesis.objects.all()[0]
     add_file_to_thesis(thesis)
     add_metadata_to_thesis(thesis)
     self.candidate.committee_members.add(self.committee_member)
     thesis.submit()
     staff_client = get_staff_client()
     response = staff_client.get(
         reverse('review_candidates', kwargs={'status': 'all'}))
     self.assertContains(response, '>Status</a>')
     self.assertContains(response, '%s, %s' % (LAST_NAME, FIRST_NAME))
     self.assertContains(response, 'Awaiting ')
コード例 #23
0
ファイル: test_views.py プロジェクト: bcail/etd_app
 def test_candidate_thesis_locked(self):
     #don't show links for changing information once the dissertation is locked
     self._create_candidate()
     add_file_to_thesis(self.candidate.thesis)
     add_metadata_to_thesis(self.candidate.thesis)
     self.candidate.committee_members.add(self.committee_member)
     self.candidate.thesis.submit()
     self.candidate.thesis.accept()
     auth_client = get_auth_client()
     response = auth_client.get(reverse('candidate_home'))
     self.assertNotContains(response, reverse('candidate_metadata'))
     self.assertNotContains(response, reverse('candidate_upload'))
     self.assertNotContains(response, reverse('candidate_committee'))
     self.assertNotContains(response, reverse('candidate_committee_remove', kwargs={'cm_id': self.committee_member.id}))
コード例 #24
0
ファイル: test_views.py プロジェクト: bcail/etd_app
 def test_upload_new_thesis_file(self):
     self._create_candidate()
     auth_client = get_auth_client()
     add_file_to_thesis(self.candidate.thesis)
     self.assertEqual(len(Thesis.objects.all()), 1)
     thesis = Candidate.objects.all()[0].thesis
     self.assertEqual(thesis.original_file_name, 'test.pdf')
     self.assertEqual(thesis.checksum, 'b1938fc5549d1b5b42c0b695baa76d5df5f81ac3')
     with open(os.path.join(self.cur_dir, 'test_files', 'test2.pdf'), 'rb') as f:
         response = auth_client.post(reverse('candidate_upload'), {'thesis_file': f})
         self.assertEqual(len(Thesis.objects.all()), 1)
         thesis = Candidate.objects.all()[0].thesis
         self.assertEqual(thesis.original_file_name, 'test2.pdf')
         self.assertEqual(thesis.checksum, '2ce252ec827258837e53b2b0bfb94141ba951f2e')
コード例 #25
0
 def test_candidate_preview(self):
     self.candidate.committee_members.add(self.committee_member)
     thesis = self.candidate.thesis
     add_file_to_thesis(thesis)
     add_metadata_to_thesis(thesis)
     auth_client = get_auth_client()
     response = auth_client.post(self.preview_url)
     self.assertContains(response, 'Preview Your Dissertation')
     self.assertContains(response, 'Name:')
     self.assertContains(response, 'Title:')
     self.assertContains(response, 'Submit Your Dissertation')
     self.assertNotContains(response, 'Embargoed until %s' % (CURRENT_YEAR + 2))
     self.candidate.embargo_end_year = CURRENT_YEAR + 2
     self.candidate.save()
     response = auth_client.post(self.preview_url)
     self.assertContains(response, 'Embargoed until %s' % (CURRENT_YEAR + 2))
コード例 #26
0
 def test_candidate_thesis_locked(self):
     #don't show links for changing information once the dissertation is locked
     self._create_candidate()
     add_file_to_thesis(self.candidate.thesis)
     add_metadata_to_thesis(self.candidate.thesis)
     self.candidate.committee_members.add(self.committee_member)
     self.candidate.thesis.submit()
     self.candidate.thesis.accept()
     auth_client = get_auth_client()
     response = auth_client.get(reverse('candidate_home'))
     self.assertNotContains(response, reverse('candidate_metadata'))
     self.assertNotContains(response, reverse('candidate_upload'))
     self.assertNotContains(response, reverse('candidate_committee'))
     self.assertNotContains(
         response,
         reverse('candidate_committee_remove',
                 kwargs={'cm_id': self.committee_member.id}))
コード例 #27
0
 def test_upload_new_thesis_file(self):
     self._create_candidate()
     auth_client = get_auth_client()
     add_file_to_thesis(self.candidate.thesis)
     self.assertEqual(len(Thesis.objects.all()), 1)
     thesis = Candidate.objects.all()[0].thesis
     self.assertEqual(thesis.original_file_name, 'test.pdf')
     self.assertEqual(thesis.checksum,
                      'b1938fc5549d1b5b42c0b695baa76d5df5f81ac3')
     with open(os.path.join(self.cur_dir, 'test_files', 'test2.pdf'),
               'rb') as f:
         response = auth_client.post(reverse('candidate_upload'),
                                     {'thesis_file': f})
         self.assertEqual(len(Thesis.objects.all()), 1)
         thesis = Candidate.objects.all()[0].thesis
         self.assertEqual(thesis.original_file_name, 'test2.pdf')
         self.assertEqual(thesis.checksum,
                          '2ce252ec827258837e53b2b0bfb94141ba951f2e')
コード例 #28
0
ファイル: test_views.py プロジェクト: bcail/etd_app
 def test_view_file(self):
     self._create_candidate()
     add_file_to_thesis(self.candidate.thesis)
     auth_client = get_auth_client()
     response = auth_client.get(reverse('view_file', kwargs={'candidate_id': self.candidate.id}))
     self.assertEqual(response.status_code, 200)
コード例 #29
0
 def test_view_file_wrong_user(self):
     self._create_candidate()
     add_file_to_thesis(self.candidate.thesis)
     auth_client = get_auth_client(username='******')
     response = auth_client.get(reverse('view_file', kwargs={'candidate_id': self.candidate.id}))
     self.assertEqual(response.status_code, 403)