Skip to content

Commit

Permalink
fixup! feat(webcal): only update modified and deleted events from web…
Browse files Browse the repository at this point in the history
…cal calendars
  • Loading branch information
miaulalala committed Jul 30, 2024
1 parent b0d2cec commit b9d52df
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use GuzzleHttp\HandlerStack;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CalDAV\WebcalCaching\RefreshWebcalService;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Http\Client\IClient;
use OCP\Http\Client\IClientService;
use OCP\Http\Client\IResponse;
Expand All @@ -34,6 +35,7 @@ class RefreshWebcalServiceTest extends TestCase {

/** @var LoggerInterface | MockObject */
private $logger;
private ITimeFactory|MockObject $time;

protected function setUp(): void {
parent::setUp();
Expand All @@ -42,6 +44,7 @@ protected function setUp(): void {
$this->clientService = $this->createMock(IClientService::class);
$this->config = $this->createMock(IConfig::class);
$this->logger = $this->createMock(LoggerInterface::class);
$this->time = $this->createMock(ITimeFactory::class);
}

/**
Expand All @@ -54,7 +57,7 @@ protected function setUp(): void {
public function testRun(string $body, string $contentType, string $result): void {
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
->onlyMethods(['getRandomCalendarObjectUri'])
->setConstructorArgs([$this->caldavBackend, $this->clientService, $this->config, $this->logger])
->setConstructorArgs([$this->caldavBackend, $this->clientService, $this->config, $this->logger, $this->time])
->getMock();

$refreshWebcalService
Expand Down Expand Up @@ -136,7 +139,7 @@ public function testRunCreateCalendarNoException(string $body, string $contentTy
$response = $this->createMock(IResponse::class);
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
->onlyMethods(['getRandomCalendarObjectUri', 'getSubscription', 'queryWebcalFeed'])
->setConstructorArgs([$this->caldavBackend, $this->clientService, $this->config, $this->logger])
->setConstructorArgs([$this->caldavBackend, $this->clientService, $this->config, $this->logger, $this->time])
->getMock();

$refreshWebcalService
Expand Down Expand Up @@ -213,7 +216,7 @@ public function testRunCreateCalendarBadRequest(string $body, string $contentTyp
$response = $this->createMock(IResponse::class);
$refreshWebcalService = $this->getMockBuilder(RefreshWebcalService::class)
->onlyMethods(['getRandomCalendarObjectUri', 'getSubscription', 'queryWebcalFeed'])
->setConstructorArgs([$this->caldavBackend, $this->clientService, $this->config, $this->logger])
->setConstructorArgs([$this->caldavBackend, $this->clientService, $this->config, $this->logger, $this->time])
->getMock();

$refreshWebcalService
Expand Down Expand Up @@ -309,7 +312,8 @@ public function testRunLocalURL(string $source): void {
$this->caldavBackend,
$this->clientService,
$this->config,
$this->logger
$this->logger,
$this->time,
);

$this->caldavBackend->expects($this->once())
Expand Down Expand Up @@ -372,7 +376,11 @@ public function runLocalURLDataProvider():array {

public function testInvalidUrl(): void {
$refreshWebcalService = new RefreshWebcalService($this->caldavBackend,
$this->clientService, $this->config, $this->logger);
$this->clientService,
$this->config,
$this->logger,
$this->time
);

$this->caldavBackend->expects($this->once())
->method('getSubscriptionsForUser')
Expand Down

0 comments on commit b9d52df

Please sign in to comment.