Update.
This commit is contained in:
@@ -2,11 +2,8 @@ import pytest
|
||||
from pathlib import Path
|
||||
import json
|
||||
from retoors.main import create_app
|
||||
from retoors.services.user_service import UserService
|
||||
from retoors.services.config_service import ConfigService
|
||||
from pytest_mock import MockerFixture # Import MockerFixture
|
||||
from unittest import mock # For AsyncMock
|
||||
import aiojobs # Import aiojobs to patch it
|
||||
import datetime # Import datetime
|
||||
|
||||
|
||||
|
||||
+1
-4
@@ -1,9 +1,6 @@
|
||||
import pytest
|
||||
from aiohttp import web
|
||||
from aiohttp_session import get_session
|
||||
from unittest.mock import AsyncMock, patch, call
|
||||
from unittest.mock import call
|
||||
|
||||
from retoors.services.user_service import UserService
|
||||
|
||||
@pytest.fixture
|
||||
async def admin_client(client):
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import pytest
|
||||
from unittest.mock import call
|
||||
import datetime
|
||||
import asyncio
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
import os
|
||||
from unittest.mock import patch, MagicMock
|
||||
from unittest.mock import patch
|
||||
from retoors.helpers.env_manager import ensure_env_file_exists, get_or_create_session_secret_key
|
||||
from cryptography.fernet import Fernet
|
||||
|
||||
|
||||
@@ -120,4 +120,80 @@ async def test_order_post_authorized(client):
|
||||
assert "Total Storage Used:" in text
|
||||
|
||||
|
||||
async def test_terms_get(client):
|
||||
resp = await client.get("/terms")
|
||||
assert resp.status == 200
|
||||
text = await resp.text()
|
||||
assert "Terms of Service" in text
|
||||
assert "By accessing and using our services, you agree to be bound by these Terms of Service" in text
|
||||
|
||||
|
||||
async def test_privacy_get(client):
|
||||
resp = await client.get("/privacy")
|
||||
assert resp.status == 200
|
||||
text = await resp.text()
|
||||
assert "Privacy Policy" in text
|
||||
assert "This Privacy Policy describes how Retoor's Cloud Solutions collects, uses, and discloses your information" in text
|
||||
|
||||
|
||||
async def test_shared_get(client):
|
||||
resp = await client.get("/shared")
|
||||
assert resp.status == 200
|
||||
text = await resp.text()
|
||||
assert "Shared with me" in text
|
||||
assert "Files and folders that have been shared with you will appear here." in text
|
||||
|
||||
|
||||
async def test_recent_get(client):
|
||||
resp = await client.get("/recent")
|
||||
assert resp.status == 200
|
||||
text = await resp.text()
|
||||
assert "Recent Files" in text
|
||||
assert "Your recently accessed files will appear here." in text
|
||||
|
||||
|
||||
async def test_favorites_get(client):
|
||||
resp = await client.get("/favorites")
|
||||
assert resp.status == 200
|
||||
text = await resp.text()
|
||||
assert "Favorites" in text
|
||||
assert "Your favorite files and folders will appear here." in text
|
||||
|
||||
|
||||
async def test_trash_get(client):
|
||||
resp = await client.get("/trash")
|
||||
assert resp.status == 200
|
||||
text = await resp.text()
|
||||
assert "Trash" in text
|
||||
assert "Files and folders you have deleted will appear here." in text
|
||||
|
||||
|
||||
async def test_file_browser_get_unauthorized(client):
|
||||
resp = await client.get("/files", allow_redirects=False)
|
||||
assert resp.status == 302
|
||||
assert resp.headers["Location"] == "/login"
|
||||
|
||||
|
||||
async def test_file_browser_get_authorized(client):
|
||||
await client.post(
|
||||
"/register",
|
||||
data={
|
||||
"full_name": "Test User",
|
||||
"email": "test@example.com",
|
||||
"password": "password",
|
||||
"confirm_password": "password",
|
||||
},
|
||||
)
|
||||
await client.post(
|
||||
"/login", data={"email": "test@example.com", "password": "password"}
|
||||
)
|
||||
resp = await client.get("/files")
|
||||
assert resp.status == 200
|
||||
text = await resp.text()
|
||||
assert "File Browser" in text
|
||||
# Check for some expected files from the project directory
|
||||
assert "example.jpg" in text
|
||||
assert "rexample7.jpg" in text
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
import json
|
||||
from retoors.services.user_service import UserService
|
||||
import bcrypt
|
||||
|
||||
Reference in New Issue
Block a user