use of com.google.gerrit.server.quota.QuotaResponse in project gerrit by GerritCodeReview.
the class DefaultQuotaBackendIT method availableTokensForUserAndAccount.
@Test
public void availableTokensForUserAndAccount() {
QuotaRequestContext ctx = QuotaRequestContext.builder().user(identifiedAdmin).account(user.id()).build();
QuotaResponse r = QuotaResponse.ok(10L);
when(quotaEnforcer.availableTokens("testGroup", ctx)).thenReturn(r);
assertThat(quotaBackend.user(identifiedAdmin).account(user.id()).availableTokens("testGroup")).isEqualTo(singletonAggregation(r));
}
use of com.google.gerrit.server.quota.QuotaResponse in project gerrit by GerritCodeReview.
the class DefaultQuotaBackendIT method availableTokensForUserAndProject.
@Test
public void availableTokensForUserAndProject() {
QuotaRequestContext ctx = QuotaRequestContext.builder().user(identifiedAdmin).project(project).build();
QuotaResponse r = QuotaResponse.ok(10L);
when(quotaEnforcer.availableTokens("testGroup", ctx)).thenReturn(r);
assertThat(quotaBackend.user(identifiedAdmin).project(project).availableTokens("testGroup")).isEqualTo(singletonAggregation(r));
}
use of com.google.gerrit.server.quota.QuotaResponse in project gerrit by GerritCodeReview.
the class DefaultQuotaBackendIT method availableTokens.
@Test
public void availableTokens() {
QuotaRequestContext ctx = QuotaRequestContext.builder().user(identifiedAdmin).build();
QuotaResponse r = QuotaResponse.ok(10L);
when(quotaEnforcer.availableTokens("testGroup", ctx)).thenReturn(r);
assertThat(quotaBackend.user(identifiedAdmin).availableTokens("testGroup")).isEqualTo(singletonAggregation(r));
}
use of com.google.gerrit.server.quota.QuotaResponse in project gerrit by GerritCodeReview.
the class DefaultQuotaBackendIT method availableTokensForUserAndChange.
@Test
public void availableTokensForUserAndChange() throws Exception {
Change.Id changeId = retrieveChangeId();
QuotaRequestContext ctx = QuotaRequestContext.builder().user(identifiedAdmin).change(changeId).project(project).build();
QuotaResponse r = QuotaResponse.ok(10L);
when(quotaEnforcer.availableTokens("testGroup", ctx)).thenReturn(r);
assertThat(quotaBackend.user(identifiedAdmin).change(changeId, project).availableTokens("testGroup")).isEqualTo(singletonAggregation(r));
}
Aggregations