[V3] Add some tests (#1590)

* Add some tests related to economy

* Add a test for repo removal

* black style formatting
This commit is contained in:
palmtree5 2018-06-09 18:00:21 -08:00 committed by Will
parent 3759fce090
commit 7b825f2cd7
2 changed files with 36 additions and 0 deletions

View File

@ -110,6 +110,18 @@ async def test_add_repo(monkeypatch, repo_manager):
assert squid.available_modules == []
@pytest.mark.asyncio
async def test_remove_repo(monkeypatch, repo_manager):
monkeypatch.setattr("redbot.cogs.downloader.repo_manager.Repo._run", fake_run_noprint)
await repo_manager.add_repo(
url="https://github.com/tekulvw/Squid-Plugins", name="squid", branch="rewrite_cogs"
)
assert repo_manager.get_repo("squid") is not None
await repo_manager.delete_repo("squid")
assert repo_manager.get_repo("squid") is None
@pytest.mark.asyncio
async def test_current_branch(bot_repo):
branch = await bot_repo.current_branch()

View File

@ -56,3 +56,27 @@ async def test_bank_can_spend(bank, member_factory):
acc = await bank.get_account(mbr)
canspendnow = await bank.can_spend(mbr, 100)
assert canspendnow
@pytest.mark.asyncio
async def test_set_bank_name(bank, guild_factory):
guild = guild_factory.get()
await bank.set_bank_name("Test Bank", guild)
name = await bank.get_bank_name(guild)
assert name == "Test Bank"
@pytest.mark.asyncio
async def test_set_currency_name(bank, guild_factory):
guild = guild_factory.get()
await bank.set_currency_name("Coins", guild)
name = await bank.get_currency_name(guild)
assert name == "Coins"
@pytest.mark.asyncio
async def test_set_default_balance(bank, guild_factory):
guild = guild_factory.get()
await bank.set_default_balance(500, guild)
default_bal = await bank.get_default_balance(guild)
assert default_bal == 500