Example #1
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)
Example #2
0
 def test_view_abstract(self):
     self._create_candidate()
     add_metadata_to_thesis(self.candidate.thesis)
     staff_client = get_staff_client()
     response = staff_client.get(
         reverse('abstract', kwargs={'candidate_id': self.candidate.id}))
     self.assertContains(response, 'test abstract')
Example #3
0
 def test_mapping(self):
     self._create_candidate()
     self.candidate.person.middle = 'Middle'
     self.candidate.committee_members.add(self.committee_member)
     self.candidate.committee_members.add(self.committee_member2)
     add_metadata_to_thesis(self.candidate.thesis)
     self.candidate.thesis.keywords.add(
         Keyword.objects.create(text='kw2',
                                authority='fast',
                                authority_uri='http://fast.com',
                                value_uri='http://fast.com/kw2'))
     self.candidate.thesis.num_prelim_pages = 'x'
     self.candidate.thesis.num_body_pages = '125'
     self.candidate.thesis.save()
     mapper = ModsMapper(self.candidate.thesis)
     mods = mapper.get_mods()
     self.assertEqual(mods.title, 'test')
     creators = [
         n for n in mods.names if (n.type == 'personal') and (
             n.roles[0].text == 'creator') and (n.roles[0].type == 'text')
     ]
     self.assertEqual(creators[0].name_parts[0].text,
                      '%s, %s Middle' % (LAST_NAME, FIRST_NAME))
     self.assertEqual(mods.origin_info.copyright[0].date, '2016')
     self.assertEqual(mods.physical_description.extent, 'x, 125 p.')
     self.assertEqual(mods.physical_description.digital_origin,
                      'born digital')
     self.assertEqual(mods.notes[0].type, 'thesis')
     self.assertEqual(mods.notes[0].text,
                      'Thesis (Ph.D.)--Brown University, 2016')
     self.assertEqual(mods.resource_type, 'text')
     self.assertEqual(mods.genres[0].text, 'theses')
     self.assertEqual(mods.genres[0].authority, 'aat')
     self.assertEqual(mods.abstract.text, 'test abstract')
     readers = [
         n for n in mods.names if (n.type == 'personal') and (
             n.roles[0].text == 'Reader') and (n.roles[0].type == 'text')
     ]
     self.assertEqual(readers[0].name_parts[0].text, 'Smith')
     advisors = [
         n for n in mods.names if (n.type == 'personal') and (
             n.roles[0].text == 'Advisor') and (n.roles[0].type == 'text')
     ]
     self.assertEqual(advisors[0].name_parts[0].text, 'Smith')
     sponsors = [
         n for n in mods.names if (n.type == 'corporate') and (
             n.roles[0].text == 'sponsor') and (n.roles[0].type == 'text')
     ]
     self.assertEqual(sponsors[0].name_parts[0].text,
                      'Brown University. Engineering')
     self.assertEqual(mods.subjects[0].topic, 'keyword')
     self.assertEqual(mods.subjects[1].topic, 'kw2')
     self.assertEqual(mods.subjects[1].authority, 'fast')
     self.assertEqual(mods.subjects[1].authority_uri, 'http://fast.com')
     self.assertEqual(mods.subjects[1].value_uri, 'http://fast.com/kw2')
     #thesis language automatically defaults to English
     self.assertEqual(mods.languages[0].terms[0].text, 'English')
     self.assertEqual(mods.languages[0].terms[0].authority, 'iso639-2b')
 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)
 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')
Example #6
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')
Example #7
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')
 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')
Example #9
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')
 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)
Example #11
0
 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)
Example #12
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')
Example #13
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 ')
Example #14
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')
Example #15
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)
Example #16
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')
Example #17
0
 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)
Example #18
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 ')
Example #19
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}))
 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))
Example #21
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}))
Example #22
0
 def test_view_abstract(self):
     self._create_candidate()
     add_metadata_to_thesis(self.candidate.thesis)
     staff_client = get_staff_client()
     response = staff_client.get(reverse('abstract', kwargs={'candidate_id': self.candidate.id}))
     self.assertContains(response, 'test abstract')