def test_api_must_delete_student_posts_reports(self):
        self.create_base_student()
        register_post(self)
        register_report(self)
        response = self.delete(self.create_student_token())

        self.assertEqual(response.status_code, 204)
    def test_api_must_return_post_about_professor(self):
        id_professor = 1
        post = valid_post(self)
        register_post(self, post=post)

        response = self.get(id_professor, self.create_student_token())
        self.assertTrue(response.status_code, 200)
        self.assertIsNotNone(response.json.get("posts"))
Beispiel #3
0
def valid_report(self):
    self.create_base_entities()
    register_post(self)
    return {
        "id_post": valid_post_id(self)["id_post"],
        "content": "Comentario me ofendeu",
        "offensive": True,
        "prejudice": False,
        "unrelated": False,
        "others": False,
    }
    def test_api_must_return_student_information_when_not_anonymous(self):
        id_professor = 1
        post = valid_post(self)
        post["is_anonymous"] = False
        register_post(self, post=post)

        response = self.get(id_professor, self.create_student_token())
        del self.discipline["id_course"]
        student_expected = {
            "course": {
                "id_course": 1,
                "name": self.course["name"]
            },
            "name": "Testing Student",
        }
        student_response = response.json["posts"][0]["student"]
        self.assertEqual(response.status_code, 200)
        self.assertEqual(student_response, student_expected)
    def test_api_must_delete_student_posts(self):
        self.create_base_student()
        response_post = register_post(self)

        response = self.delete(self.create_student_token())

        self.assertEqual(response_post.status_code, 201)
        self.assertEqual(response.status_code, 204)
        self.assertIsNone(
            post_services.get(reg_student=self.student["reg_student"]))