def test_deletes_prohibited_project_name(self, db_request):
        prohibited_project_name = ProhibitedProjectFactory.create()
        db_request.POST["prohibited_project_name_id"] = str(
            prohibited_project_name.id)
        db_request.route_path = lambda a: "/admin/prohibited_project_names/"

        resp = views.remove_prohibited_project_names(db_request)

        assert resp.status_code == 303
        assert resp.headers["Location"] == "/admin/prohibited_project_names/"
        assert not (db_request.db.query(ProhibitedProjectName).filter(
            ProhibitedProjectName.id == prohibited_project_name.id).count())
    def test_prohibited_project_name_id_not_exist(self, db_request):
        db_request.POST["prohibited_project_name_id"] = str(uuid.uuid4())

        with pytest.raises(HTTPNotFound):
            views.remove_prohibited_project_names(db_request)
    def test_no_prohibited_project_name_id(self):
        request = pretend.stub(POST={})

        with pytest.raises(HTTPBadRequest):
            views.remove_prohibited_project_names(request)