shared-hosting/check/tests/test_factory.py

44 lines
1.4 KiB
Python

# Copyright © 2022 Aravinth Manivannan <realaravinth@batsense.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from check.factory import Factory
from .test_payments import DummyValidator
from .test_forge import DummyForge
from .test_alert import DummyAlert
class DummyFactory(Factory):
def __init__(self):
forge = DummyForge()
val = DummyValidator()
paying_users = forge.users[0:3]
val.set_paying_users(paying_users)
super().__init__(forge=forge, val=val, alert=DummyAlert())
def test_dummy_factory():
f = DummyFactory()
paying = 0
non_paying = 0
for user in f.forge.users:
if f.val.is_paying(user=user):
paying+=1
else:
non_paying+=1
assert paying == non_paying == 3
for cus in f.val.paying_users:
assert "no-paying" not in cus