def test_truncate_should_only_truncate_given_names(monkeypatch): factories.MunicipalityFactory() factories.GroupFactory() monkeypatch.setattr('ban.commands.helpers.confirm', lambda *x, **wk: True) truncate('group') assert models.Municipality.select().count() assert not models.Group.select().count()
def test_truncate_should_truncate_all_tables_by_default(monkeypatch): factories.MunicipalityFactory() factories.GroupFactory() monkeypatch.setattr('ban.commands.helpers.confirm', lambda *x, **wk: True) truncate() assert not models.Municipality.select().count() assert not models.Group.select().count()
def test_truncate_should_not_ask_for_confirm_in_force_mode(monkeypatch): factories.MunicipalityFactory() truncate(force=True) assert not models.Municipality.select().count()