def test_level_sharing_with_empty_school(self): teacher1, email1, password1 = signup_teacher_directly() teacher2, _, _ = signup_teacher_directly() self.login(email1, password1) level_id = create_save_level(teacher1) school1 = create_school() add_teacher_to_school(teacher1, school1) sharing_info1 = json.loads(self.get_sharing_information(level_id).getvalue()) assert_that(len(sharing_info1["teachers"]), equal_to(0))
def test_level_sharing_with_empty_school(self): email1, password1 = signup_teacher_directly() teacher1 = Teacher.objects.get(new_user__email=email1) self.login(email1, password1) level_id = create_save_level(teacher1) school1 = create_school() add_teacher_to_school(teacher1, school1) sharing_info1 = json.loads( self.get_sharing_information(level_id).getvalue()) assert_that(len(sharing_info1["teachers"]), equal_to(0))
def test_level_sharing_with_school(self): teacher1, email1, password1 = signup_teacher_directly() teacher2, _, _ = signup_teacher_directly() self.login(email1, password1) level_id = create_save_level(teacher1) school1 = create_school() add_teacher_to_school(teacher1, school1) add_teacher_to_school(teacher2, school1) sharing_info1 = json.loads( self.get_sharing_information(level_id).getvalue()) assert_that(len(sharing_info1["teachers"]), equal_to(1))
def test_level_can_only_be_shared_by_owner(self): teacher1, email1, password1 = signup_teacher_directly() teacher2, email2, password2 = signup_teacher_directly() self.login(email1, password1) level_id = create_save_level(teacher1) school1 = create_school() add_teacher_to_school(teacher1, school1) self.logout() self.login(email2, password2) url = reverse("share_level_for_editor", args=[level_id]) data = {u"recipientIDs[]": [teacher2.id], u"action": ["share"]} response = self.client.post(url, {"data": data}) assert_that(response.status_code, equal_to(403))