def setUp(self): u = User() u.username = '******' u.save() r = Reviewer() r.user = u r.name = 'Luke' r.affiliation = 'COS' r.email = '*****@*****.**' r.bio = 'I love to have fun.' r.research = 'Fun Facts' r.website = 'http://lukemarsh.com' r.osfreviews = 0 r.save() s = Submission() s.conference = 'FooCon' s.title = 'Effects of Foo on Bar' s.reviewdeadline = datetime.date(2016, 12, 25).isoformat() s.authorname = 'Foo Bar' s.authoremail = '*****@*****.**' s.status = 'Awaiting review' s.link = 'http://foobar.org' s.attachment = '/foo/bar.pdf' s.save() s.reviewer.add(r) s.save() u2 = User() u2.username = '******' u2.save() ed = Editor() ed.user = u2 ed.name = 'Tom Heatwole' ed.email = '*****@*****.**' ed.save() s.editor = ed s.save() ev = Evaluation() ev.status = 'Pending' ev.progress = 'Received' ev.premise = 5 ev.research = 6 ev.style = 4 ev.comment = 'This is a comment.' ev.reviewer = r ev.submission = s ev.save()
def test_editors_cant_edit_evaluations(self): u = User() u.username = '******' u.set_password('goscience') u.save() c = Client() logged_in = c.login(username='******', password='******') self.assertTrue(logged_in) self.assertTrue(u) ed = Editor() ed.user = u ed.name = 'Foo Bar' ed.email = '*****@*****.**' ed.save() ev = Evaluation.objects.first() ev.comment = 'I shouldn\'t be allowed to save this edit.' ev.save()