aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2022-09-13 16:52:44 +0200
committerRobin Appelman <robin@icewind.nl>2024-06-21 11:01:46 +0200
commitf6d18f8303882a43510d67c787410aec7c8e28e8 (patch)
treeaefae7e31c4d41882f903ef720c5516198c055fe /tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
parentf56bca3385243f5f996b47b811a218c00816a215 (diff)
downloadnextcloud-server-merge-token-updates.tar.gz
nextcloud-server-merge-token-updates.zip
perf: merge last_activity and last_check updatesmerge-token-updates
the debounce for updating last_activity is changed so it always updates if another field of the token has been updated, this ensures that last_check if updated even if last_activity is still in the debounce period. Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php')
-rw-r--r--tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index 3c81eade700..5f0f65e2cc9 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -191,8 +191,6 @@ class PublicKeyTokenProviderTest extends TestCase {
]);
$this->tokenProvider->updateTokenActivity($tk);
-
- $this->assertEquals($this->time, $tk->getLastActivity());
}
public function testUpdateTokenDebounce() {
@@ -210,6 +208,22 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->updateTokenActivity($tk);
}
+ public function testUpdateTokenDebounceWithUpdatedFields() {
+ $tk = new PublicKeyToken();
+ $this->config->method('getSystemValueInt')
+ ->willReturnCallback(function ($value, $default) {
+ return $default;
+ });
+ $tk->setLastActivity($this->time - 30);
+ $tk->setLastCheck($this->time - 30);
+
+ $this->mapper->expects($this->once())
+ ->method('updateActivity')
+ ->with($tk, $this->time);
+
+ $this->tokenProvider->updateTokenActivity($tk);
+ }
+
public function testGetTokenByUser() {
$this->mapper->expects($this->once())
->method('getTokenByUser')