Skip to content

Commit

Permalink
contracts: wip: Add .only to restrict to the “usual suspects”
Browse files Browse the repository at this point in the history
  • Loading branch information
bingen committed Nov 26, 2020
1 parent e83cd30 commit 9b13f6d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
31 changes: 11 additions & 20 deletions packages/contracts/test/AccessControlTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,27 +56,18 @@ contract('All Liquity functions with intra-system access control restrictions',

describe('CDPManager', async accounts => {
// applyPendingRewards
it("applyPendingRewards(): reverts when called by an account that is not BorrowerOperations", async () => {
it.only("applyPendingRewards(): reverts when called by an account that is not BorrowerOperations", async () => {
// Attempt call from alice
try {
const txAlice = await cdpManager.applyPendingRewards(bob, { from: alice })
assert.isFalse(txAlice.receipt.status)
} catch (err) {
assert.include(err.message, "revert")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
const txAlice = cdpManager.applyPendingRewards(bob, { from: alice })
await th.assertRevert(txAlice, "Caller is not the BorrowerOperations contract")
})

// updateRewardSnapshots
it("updateRewardSnapshots(): reverts when called by an account that is not BorrowerOperations", async () => {
it.only("updateRewardSnapshots(): reverts when called by an account that is not BorrowerOperations", async () => {
// Attempt call from alice
try {
const txAlice = await cdpManager.updateCDPRewardSnapshots(bob, { from: alice })
assert.isFalse(txAlice.receipt.status)
} catch (err) {
assert.include(err.message, "revert")
assert.include(err.message, "Caller is not the BorrowerOperations contract")
}
console.log(bob, { from: alice })
const txAlice = await cdpManager.updateCDPRewardSnapshots(bob, { from: alice })
await th.assertRevert(txAlice, "Caller is not the BorrowerOperations contract")
})

// removeStake
Expand Down Expand Up @@ -323,14 +314,14 @@ contract('All Liquity functions with intra-system access control restrictions',
describe('CLVToken', async accounts => {

// mint
it("mint(): reverts when called by an account that is not BorrowerOperations", async () => {
it.only("mint(): reverts when called by an account that is not BorrowerOperations", async () => {
// Attempt call from alice
const txAlice = clvToken.mint(bob, 100, { from: alice })
await th.assertRevert(txAlice, "Caller is not BorrowerOperations")
})

// burn
it("burn(): reverts when called by an account that is not BO nor CDPM nor SP", async () => {
it.only("burn(): reverts when called by an account that is not BO nor CDPM nor SP", async () => {
// Attempt call from alice
try {
const txAlice = await clvToken.burn(bob, 100, { from: alice })
Expand All @@ -342,7 +333,7 @@ contract('All Liquity functions with intra-system access control restrictions',
})

// sendToPool
it("sendToPool(): reverts when called by an account that is not StabilityPool", async () => {
it.only("sendToPool(): reverts when called by an account that is not StabilityPool", async () => {
// Attempt call from alice
try {
const txAlice = await clvToken.sendToPool(bob, activePool.address, 100, { from: alice })
Expand All @@ -354,7 +345,7 @@ contract('All Liquity functions with intra-system access control restrictions',
})

// returnFromPool
it("returnFromPool(): reverts when called by an account that is not CDPManager nor StabilityPool", async () => {
it.only("returnFromPool(): reverts when called by an account that is not CDPManager nor StabilityPool", async () => {
// Attempt call from alice
try {
const txAlice = await clvToken.returnFromPool(activePool.address, bob, 100, { from: alice })
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/test/StabilityPoolTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -3555,7 +3555,7 @@ contract('StabilityPool', async accounts => {
assert.equal((await stabilityPool.frontEnds(E))[0], '0')
})

it("registerFrontEnd(): reverts if the front end is already registered", async () => {
it.only("registerFrontEnd(): reverts if the front end is already registered", async () => {

await stabilityPool.registerFrontEnd(dec(1, 18), { from: A })
await stabilityPool.registerFrontEnd('897789897897897', { from: B })
Expand Down

0 comments on commit 9b13f6d

Please sign in to comment.