feat(project): meeting board button opens a blank Google Slides deck
A "회의록 보드" button next to attendees opens the week's Google Slides deck in its own window. The deck is found (Drive appProperties) or created in the shared drive MEETING_BOARD_FOLDER_ID as one BLANK slide, named like "10월 2주차 (10/5~10/11)". Needs a token with Drive and Slides scopes; the authorize script now requests them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -459,6 +459,29 @@ function meetServer(env, st) {
|
||||
check("[2e] 월 목표 직접 저장 요청 없음", !st.metric);
|
||||
});
|
||||
|
||||
// ════════════════════ [2f] 회의록 보드 — 누르는 순간 창을 열고, 서버가 준 Google 슬라이드 주소로 바꾼다 ════════════════════
|
||||
await section(async function () {
|
||||
const env = makeEnv(PAGE.meeting_ro, MEET_URL); // 보기만 하는 사람도 연다
|
||||
meetServer(env);
|
||||
let posted = null;
|
||||
env.route("POST", /\/project\/api\/goals\/meetings\/2026-09-28\/board$/, function (u, body) {
|
||||
posted = u;
|
||||
return { body: { ok: true, url: "https://docs.google.com/presentation/d/abc/edit", created: true, title: "9월 5주차 (9/28~9/30)" } };
|
||||
});
|
||||
await boot(env);
|
||||
const popup = { closed: false, focused: false, location: { href: "about:blank", replace: function (u) { this.href = u; } },
|
||||
document: { title: "", body: {} }, focus: function () { this.focused = true; }, close: function () { this.closed = true; } };
|
||||
let opened = null;
|
||||
env.w.open = function (url, name, features) { opened = { url: url, name: name, features: features }; return popup; };
|
||||
const btn = env.d.getElementById("pj-meet-board");
|
||||
check("[2f] 참석자 옆 회의록 보드 버튼", !!btn && !!btn.closest(".pj-meet-attend"));
|
||||
btn.click();
|
||||
check("[2f] 누르는 순간 독립 창(popup)을 연다", opened && opened.name === "pj_meet_board_2026-09-28" && /popup/.test(opened.features), opened);
|
||||
await settle(); await wait(10); await settle();
|
||||
check("[2f] 서버에 그 주차 보드 요청", !!posted);
|
||||
check("[2f] 창을 슬라이드 주소로", popup.location.href === "https://docs.google.com/presentation/d/abc/edit" && popup.focused);
|
||||
});
|
||||
|
||||
// ════════════════════ [3] 목표 표 — 글 저장 실패면 구조 변경·표 교체 중단 ════════════════════
|
||||
await section(async function () {
|
||||
const env = makeEnv(PAGE.goals_admin, GOALS_URL, { promptAnswer: "새 영역" });
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
"""회의록 보드(Google 슬라이드) — 가짜 Drive·Slides 로 찾기·빈 슬라이드 만들기·API 를 검증한다. 네트워크·DB 없이 실행."""
|
||||
import importlib
|
||||
import unittest
|
||||
from datetime import date
|
||||
from unittest.mock import patch
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.integrations import google_slides as gs
|
||||
|
||||
api = importlib.import_module("app.modules.project.router")
|
||||
|
||||
|
||||
class Call:
|
||||
def __init__(self, result):
|
||||
self.result = result
|
||||
|
||||
def execute(self):
|
||||
return self.result
|
||||
|
||||
|
||||
class FakeDrive:
|
||||
def __init__(self, existing=None):
|
||||
self.existing, self.created, self.queries = existing, [], []
|
||||
|
||||
def files(self):
|
||||
return self
|
||||
|
||||
def list(self, **kw):
|
||||
self.queries.append(kw)
|
||||
return Call({"files": [{"id": self.existing}] if self.existing else []})
|
||||
|
||||
def create(self, body, fields, supportsAllDrives):
|
||||
assert supportsAllDrives is True
|
||||
self.created.append(body)
|
||||
return Call({"id": "new-file"})
|
||||
|
||||
|
||||
class FakeSlides:
|
||||
def __init__(self):
|
||||
self.batches = []
|
||||
|
||||
def presentations(self):
|
||||
return self
|
||||
|
||||
def get(self, presentationId, fields):
|
||||
return Call({"slides": [{"objectId": "title-slide"}]})
|
||||
|
||||
def batchUpdate(self, presentationId, body):
|
||||
self.batches.append((presentationId, body))
|
||||
return Call({})
|
||||
|
||||
|
||||
def client_with(drive, slides):
|
||||
c = gs.GoogleSlidesClient.__new__(gs.GoogleSlidesClient)
|
||||
c.enabled, c.reason, c.auth_mode = True, "", "oauth"
|
||||
c._drive, c._slides = drive, slides
|
||||
return c
|
||||
|
||||
|
||||
class MeetingBoardTests(unittest.TestCase):
|
||||
def test_existing_board_is_reused_without_creating(self):
|
||||
drive, slides = FakeDrive(existing="abc"), FakeSlides()
|
||||
out = client_with(drive, slides).open_week_board(folder_id="F", week_key="2026-10-05", title="10월 2주차 (10/5~10/11)")
|
||||
self.assertEqual(out, {"id": "abc", "url": "https://docs.google.com/presentation/d/abc/edit", "created": False})
|
||||
self.assertEqual(drive.created, [])
|
||||
q = drive.queries[0]["q"]
|
||||
self.assertIn("'F' in parents", q)
|
||||
self.assertIn("key='dbxMeetingWeek' and value='2026-10-05'", q)
|
||||
self.assertTrue(drive.queries[0]["supportsAllDrives"] and drive.queries[0]["includeItemsFromAllDrives"])
|
||||
|
||||
def test_new_board_is_blank_slide_in_folder(self):
|
||||
drive, slides = FakeDrive(), FakeSlides()
|
||||
out = client_with(drive, slides).open_week_board(folder_id="F", week_key="2026-10-05", title="10월 2주차 (10/5~10/11)")
|
||||
self.assertTrue(out["created"])
|
||||
body = drive.created[0]
|
||||
self.assertEqual(body["parents"], ["F"])
|
||||
self.assertEqual(body["name"], "10월 2주차 (10/5~10/11)")
|
||||
self.assertEqual(body["mimeType"], gs.PRESENTATION_MIME)
|
||||
self.assertEqual(body["appProperties"], {"dbxMeetingWeek": "2026-10-05"})
|
||||
# 제목·부제목 틀이 있는 첫 장은 지우고 틀 없는 빈 장(BLANK) 하나만
|
||||
reqs = slides.batches[0][1]["requests"]
|
||||
self.assertEqual(reqs[0]["createSlide"]["slideLayoutReference"], {"predefinedLayout": "BLANK"})
|
||||
self.assertEqual(reqs[1:], [{"deleteObject": {"objectId": "title-slide"}}])
|
||||
|
||||
def test_disabled_client_and_api_errors_have_safe_messages(self):
|
||||
off = gs.GoogleSlidesClient.__new__(gs.GoogleSlidesClient)
|
||||
off.enabled, off.reason = False, "Google 인증 미설정"
|
||||
with self.assertRaises(gs.GoogleSlidesError):
|
||||
off.open_week_board(folder_id="F", week_key="2026-10-05", title="t")
|
||||
self.assertIn("토큰을 다시 발급", gs._friendly(RuntimeError("invalid_scope: Bad Request")))
|
||||
|
||||
def test_title_uses_month_week_and_period(self):
|
||||
self.assertEqual(api.meeting_board_title(date(2026, 10, 5)), "10월 2주차 (10/5~10/11)")
|
||||
self.assertEqual(api.meeting_board_title(date(2026, 11, 1)), "11월 1주차 (11/1~11/8)")
|
||||
|
||||
def test_api_returns_url_and_maps_errors(self):
|
||||
app = FastAPI()
|
||||
app.include_router(api.router)
|
||||
client = TestClient(app)
|
||||
fake = client_with(FakeDrive(existing="abc"), FakeSlides())
|
||||
with patch.object(api, "_require_user", return_value={"email": "u@test"}), \
|
||||
patch.object(gs, "get_client", return_value=fake):
|
||||
r = client.post("/project/api/goals/meetings/2026-10-05/board")
|
||||
self.assertEqual(r.status_code, 200, r.text)
|
||||
self.assertEqual(r.json()["url"], "https://docs.google.com/presentation/d/abc/edit")
|
||||
self.assertEqual(client.post("/project/api/goals/meetings/2026-10-06/board").status_code, 400) # 주차 시작일 아님
|
||||
off = gs.GoogleSlidesClient.__new__(gs.GoogleSlidesClient)
|
||||
off.enabled, off.reason = False, "Google 인증 미설정"
|
||||
with patch.object(api, "_require_user", return_value={"email": "u@test"}), \
|
||||
patch.object(gs, "get_client", return_value=off):
|
||||
r = client.post("/project/api/goals/meetings/2026-10-05/board")
|
||||
self.assertEqual(r.status_code, 503)
|
||||
self.assertIn("Google 인증 미설정", r.json()["detail"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user