Основные изменения: - Добавлены E2E тесты для проверки ownership (TC-E2E-102/103): * test_admin_can_edit_any_post — admin может редактировать любой пост * test_user_cannot_edit_other_users_post — user не может редактировать чужой пост - Исправлены use cases (UpdatePost, DeletePost, PublishPost) — добавлена проверка роли admin - Обновлены web routes и API routes для передачи роли в use cases - Добавлены unit тесты для admin-сценариев Реструктуризация тестов: - Удалены старые API тесты (tests/api/) — требуют переработки - Удалены старые integration тесты (tests/integration/) - Переработаны E2E тесты: удалены старые, добавлены новые с POM - Добавлена документация тестов: FEATURE_*.md, TEST_MODEL.md, AGENTS.md Инфраструктура: - Добавлен MockKeycloakClient для dev-режима - Добавлены статические файлы: EasyMDE, Highlight.js, стили markdown - Обновлены шаблоны: base.html, post_form.html, post_detail.html - Обновлена DI конфигурация и провайдеры Документация: - tests/FEATURE_RBAC.md — матрица тестов RBAC - tests/FEATURE_POST_LIFECYCLE.md — тесты жизненного цикла поста - tests/FEATURE_DOMAIN_FOUNDATION.md — тесты доменного слоя - tests/FEATURE_INFRASTRUCTURE.md — тесты инфраструктуры - tests/TEST_MODEL.md — глобальная матрица покрытия - app/presentation/web/AGENTS.md — гайд по Web UI - tests/AGENTS.md — гайд по тестированию
185 lines
5.9 KiB
HTML
185 lines
5.9 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en" data-testid="html-root">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="description" content="{% block meta_description %}Blog - A modern blogging platform built with FastAPI{% endblock %}">
|
|
<meta name="keywords" content="{% block meta_keywords %}blog, articles, posts, writing{% endblock %}">
|
|
<meta name="author" content="{% block meta_author %}Blog Team{% endblock %}">
|
|
<meta name="robots" content="{% block meta_robots %}index, follow{% endblock %}">
|
|
|
|
<!-- Canonical URL -->
|
|
<link rel="canonical" href="{% block canonical_url %}{{ request.url }}{% endblock %}">
|
|
|
|
<!-- Open Graph / Facebook -->
|
|
<meta property="og:type" content="{% block og_type %}website{% endblock %}">
|
|
<meta property="og:url" content="{% block og_url %}{{ request.url }}{% endblock %}">
|
|
<meta property="og:title" content="{% block og_title %}{{ self.title() }}{% endblock %}">
|
|
<meta property="og:description" content="{% block og_description %}{{ self.meta_description() }}{% endblock %}">
|
|
<meta property="og:image" content="{% block og_image %}{{ request.base_url }}static/images/og-default.png{% endblock %}">
|
|
<meta property="og:site_name" content="Blog">
|
|
|
|
<!-- Twitter -->
|
|
<meta property="twitter:card" content="{% block twitter_card %}summary_large_image{% endblock %}">
|
|
<meta property="twitter:url" content="{% block twitter_url %}{{ request.url }}{% endblock %}">
|
|
<meta property="twitter:title" content="{% block twitter_title %}{{ self.title() }}{% endblock %}">
|
|
<meta property="twitter:description" content="{% block twitter_description %}{{ self.meta_description() }}{% endblock %}">
|
|
<meta property="twitter:image" content="{% block twitter_image %}{{ self.og_image() }}{% endblock %}">
|
|
|
|
<!-- Favicon -->
|
|
<link rel="icon" type="image/svg+xml" href="/static/images/favicon.svg">
|
|
<link rel="alternate icon" href="/static/images/favicon.ico">
|
|
|
|
<title data-testid="page-title">{% block title %}Blog{% endblock %}</title>
|
|
|
|
<link rel="stylesheet" href="/static/css/themes/theme-light.css" data-testid="theme-light-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/themes/theme-dark.css" data-testid="theme-dark-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/base.css" data-testid="base-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/components.css" data-testid="components-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/layout.css" data-testid="layout-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/markdown.css" data-testid="markdown-stylesheet">
|
|
<link rel="stylesheet" href="/static/css/pygments.css" data-testid="pygments-stylesheet">
|
|
|
|
{% block extra_css %}{% endblock %}
|
|
</head>
|
|
<body data-testid="body">
|
|
{% include "partials/header.html" %}
|
|
|
|
<!-- Flash Messages -->
|
|
{% if flash_messages %}
|
|
<div class="flash-container" data-testid="flash-container">
|
|
{% for msg in flash_messages %}
|
|
<div class="flash-message flash-{{ msg.category }}" data-testid="flash-message-{{ msg.category }}" role="alert">
|
|
<span class="flash-text" data-testid="flash-text">{{ msg.message }}</span>
|
|
<button type="button" class="flash-close" data-testid="flash-close" aria-label="Close message">×</button>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<main class="main-wrapper" data-testid="main-content">
|
|
<div class="container" data-testid="container">
|
|
{% block content %}{% endblock %}
|
|
</div>
|
|
</main>
|
|
|
|
{% include "partials/footer.html" %}
|
|
|
|
<script src="/static/js/theme.js" data-testid="theme-script"></script>
|
|
<script src="/static/js/flash.js" data-testid="flash-script"></script>
|
|
{% block extra_js %}{% endblock %}
|
|
</body>
|
|
</html>
|
|
|
|
<style>
|
|
.flash-container {
|
|
position: fixed;
|
|
top: 5rem;
|
|
right: 1rem;
|
|
z-index: 1000;
|
|
max-width: 400px;
|
|
width: calc(100% - 2rem);
|
|
}
|
|
|
|
.flash-message {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
gap: 1rem;
|
|
padding: 1rem 1.25rem;
|
|
margin-bottom: 0.75rem;
|
|
border-radius: 8px;
|
|
border: 1px solid transparent;
|
|
box-shadow: 0 4px 12px var(--color-shadow);
|
|
animation: slideIn 0.3s ease;
|
|
}
|
|
|
|
@keyframes slideIn {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateX(100%);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateX(0);
|
|
}
|
|
}
|
|
|
|
.flash-message.fade-out {
|
|
animation: slideOut 0.3s ease forwards;
|
|
}
|
|
|
|
@keyframes slideOut {
|
|
from {
|
|
opacity: 1;
|
|
transform: translateX(0);
|
|
}
|
|
to {
|
|
opacity: 0;
|
|
transform: translateX(100%);
|
|
}
|
|
}
|
|
|
|
.flash-success {
|
|
background-color: var(--color-success-bg);
|
|
border-color: var(--color-success-border);
|
|
color: var(--color-success-text);
|
|
}
|
|
|
|
.flash-error {
|
|
background-color: var(--color-error-bg);
|
|
border-color: var(--color-error-border);
|
|
color: var(--color-error-text);
|
|
}
|
|
|
|
.flash-warning {
|
|
background-color: var(--color-warning-bg);
|
|
border-color: var(--color-warning-border);
|
|
color: var(--color-warning-text);
|
|
}
|
|
|
|
.flash-info {
|
|
background-color: var(--color-info-bg);
|
|
border-color: var(--color-info-border);
|
|
color: var(--color-info-text);
|
|
}
|
|
|
|
.flash-text {
|
|
flex: 1;
|
|
font-size: 0.9375rem;
|
|
}
|
|
|
|
.flash-close {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 1.5rem;
|
|
height: 1.5rem;
|
|
padding: 0;
|
|
background: transparent;
|
|
border: none;
|
|
color: inherit;
|
|
font-size: 1.25rem;
|
|
cursor: pointer;
|
|
opacity: 0.6;
|
|
transition: opacity 0.2s ease;
|
|
}
|
|
|
|
.flash-close:hover {
|
|
opacity: 1;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.flash-container {
|
|
top: 4rem;
|
|
left: 1rem;
|
|
right: 1rem;
|
|
max-width: none;
|
|
}
|
|
|
|
.flash-message {
|
|
padding: 0.875rem 1rem;
|
|
}
|
|
}
|
|
</style>
|