mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-23 06:30:48 +08:00
Add image reference tracking
This commit is contained in:
@@ -2,6 +2,7 @@ package com.openisle.service;
|
||||
|
||||
import com.qcloud.cos.COSClient;
|
||||
import com.qcloud.cos.model.PutObjectRequest;
|
||||
import com.openisle.repository.ImageRepository;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
@@ -11,7 +12,8 @@ class CosImageUploaderTest {
|
||||
@Test
|
||||
void uploadReturnsUrl() {
|
||||
COSClient client = mock(COSClient.class);
|
||||
CosImageUploader uploader = new CosImageUploader(client, "bucket", "http://cos.example.com");
|
||||
ImageRepository repo = mock(ImageRepository.class);
|
||||
CosImageUploader uploader = new CosImageUploader(client, repo, "bucket", "http://cos.example.com");
|
||||
|
||||
String url = uploader.upload("data".getBytes(), "img.png").join();
|
||||
|
||||
|
||||
@@ -24,11 +24,12 @@ class PostServiceTest {
|
||||
PostSubscriptionRepository subRepo = mock(PostSubscriptionRepository.class);
|
||||
NotificationRepository notificationRepo = mock(NotificationRepository.class);
|
||||
PostReadService postReadService = mock(PostReadService.class);
|
||||
ImageUploader imageUploader = mock(ImageUploader.class);
|
||||
|
||||
PostService service = new PostService(postRepo, userRepo, catRepo, tagRepo,
|
||||
notifService, subService, commentService, commentRepo,
|
||||
reactionRepo, subRepo, notificationRepo, postReadService,
|
||||
PublishMode.DIRECT);
|
||||
imageUploader, PublishMode.DIRECT);
|
||||
|
||||
Post post = new Post();
|
||||
post.setId(1L);
|
||||
|
||||
Reference in New Issue
Block a user