Github user bhaisaab commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1350#discussion_r51005837 --- Diff: framework/quota/test/org/apache/cloudstack/quota/QuotaManagerImplTest.java --- @@ -197,4 +197,58 @@ public void testProcessQuotaBalanceForAccount() { Mockito.verify(quotaAcc, Mockito.times(1)).persistQuotaAccount(Mockito.any(QuotaAccountVO.class)); } + @Test + public void testAdminLockableAccount() { + AccountVO accountVO = new AccountVO(); + accountVO.setId(2L); + accountVO.setDomainId(1L); + accountVO.setType(Account.ACCOUNT_TYPE_ADMIN); + assertFalse(quotaManager.isLockable(accountVO)); + } + + @Test + public void testNormalLockableAccount() { + AccountVO accountVO = new AccountVO(); + accountVO.setId(3L); + accountVO.setDomainId(1L); + accountVO.setType(Account.ACCOUNT_TYPE_NORMAL); + assertTrue(quotaManager.isLockable(accountVO)); + } + + @Test + public void tesDomainAdmingLockableAccount() { + AccountVO accountVO = new AccountVO(); + accountVO.setId(5L); + accountVO.setDomainId(1L); + accountVO.setType(Account.ACCOUNT_TYPE_DOMAIN_ADMIN); + assertTrue(quotaManager.isLockable(accountVO)); + } + + @Test + public void testReadOnlyAdminLockableAccount() { + AccountVO accountVO = new AccountVO(); + accountVO.setId(6L); + accountVO.setDomainId(1L); + accountVO.setType(Account.ACCOUNT_TYPE_READ_ONLY_ADMIN); + assertFalse(quotaManager.isLockable(accountVO)); + } + + @Test + public void testResourceDomainAdminLockableAccount() { + AccountVO accountVO = new AccountVO(); + accountVO.setId(7L); + accountVO.setDomainId(1L); + accountVO.setType(Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN); + assertFalse(quotaManager.isLockable(accountVO)); + } + + @Test + public void testProjectLockableAccount() { + AccountVO accountVO = new AccountVO(); + accountVO.setId(7L); + accountVO.setDomainId(1L); + accountVO.setType(Account.ACCOUNT_TYPE_PROJECT); + assertFalse(quotaManager.isLockable(accountVO)); --- End diff -- @abhinandanprateek We can actually remove the setId and setDomainId in all the testxxxLockableAccounts; create like a single class leve AccountVO and then in each of the testxxxLockableAccounts methods simply call the setType method and then call assert on them.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---