From 8685429c9c48564d262d92b7865a991c84ca5751 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Fri, 6 May 2016 00:12:00 -0400 Subject: [PATCH] stub out Team takes Python --- gratipay/models/team/__init__.py | 3 ++- gratipay/models/team/mixins/__init__.py | 3 +++ gratipay/models/team/mixins/takes.py | 19 +++++++++++++++++++ tests/py/test_team_takes.py | 11 +++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 gratipay/models/team/mixins/__init__.py create mode 100644 gratipay/models/team/mixins/takes.py create mode 100644 tests/py/test_team_takes.py diff --git a/gratipay/models/team/__init__.py b/gratipay/models/team/__init__.py index 5e0ec230fe..5e53da9723 100644 --- a/gratipay/models/team/__init__.py +++ b/gratipay/models/team/__init__.py @@ -7,6 +7,7 @@ from aspen import json, log from gratipay.exceptions import InvalidTeamName from gratipay.models import add_event +from gratipay.models.team import mixins from postgres.orm import Model from gratipay.billing.exchanges import MINIMUM_CHARGE @@ -30,7 +31,7 @@ def slugize(name): return slug -class Team(Model): +class Team(Model, mixins.Takes): """Represent a Gratipay team. """ diff --git a/gratipay/models/team/mixins/__init__.py b/gratipay/models/team/mixins/__init__.py new file mode 100644 index 0000000000..ba9a106282 --- /dev/null +++ b/gratipay/models/team/mixins/__init__.py @@ -0,0 +1,3 @@ +from .takes import TakesMixin as Takes + +__all__ = ['Takes'] diff --git a/gratipay/models/team/mixins/takes.py b/gratipay/models/team/mixins/takes.py new file mode 100644 index 0000000000..a744aeea75 --- /dev/null +++ b/gratipay/models/team/mixins/takes.py @@ -0,0 +1,19 @@ +from __future__ import absolute_import, division, print_function, unicode_literals + + +class TakesMixin(object): + """This mixing provides management of takes for + :py:class:`~gratipay.models.team.Team` objects. + """ + + + def enable_takes(self): + """Allow this Team to issue takes. + """ + pass + + + def disable_takes(self): + """Prevent this Team from issuing takes. + """ + pass diff --git a/tests/py/test_team_takes.py b/tests/py/test_team_takes.py new file mode 100644 index 0000000000..59c900fa94 --- /dev/null +++ b/tests/py/test_team_takes.py @@ -0,0 +1,11 @@ +from __future__ import absolute_import, division, print_function, unicode_literals + +from gratipay.testing import Harness +from gratipay.models.team import mixins + + +class Tests(Harness): + + def test_team_object_subclasses_takes_mixin(self): + enterprise = self.make_team('The Enterprise') + assert isinstance(enterprise, mixins.Takes)