Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' into payday-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbk authored Feb 24, 2017
2 parents 16e3b8a + b3426f0 commit 22adf42
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 37 deletions.
6 changes: 3 additions & 3 deletions gratipay/models/participant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
from gratipay.models.account_elsewhere import AccountElsewhere
from gratipay.models.exchange_route import ExchangeRoute
from gratipay.models.team import Team
from gratipay.models.team.mixins.takes import ZERO
from gratipay.models.participant import mixins
from gratipay.models.team.takes import ZERO
from gratipay.security.crypto import constant_time_compare
from gratipay.utils import (
i18n,
Expand All @@ -51,6 +50,7 @@
)
from gratipay.utils.username import safely_reserve_a_username

from .identity import Identity

ASCII_ALLOWED_IN_USERNAME = set("0123456789"
"abcdefghijklmnopqrstuvwxyz"
Expand All @@ -63,7 +63,7 @@
USERNAME_MAX_SIZE = 32


class Participant(Model, mixins.Identity):
class Participant(Model, Identity):
"""Represent a Gratipay participant.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _validate_info(schema_name, info):
return None


class IdentityMixin(object):
class Identity(object):
"""This mixin provides management of national identities for
:py:class:`~gratipay.models.participant.Participant` objects.
Expand Down
3 changes: 0 additions & 3 deletions gratipay/models/participant/mixins/__init__.py

This file was deleted.

10 changes: 7 additions & 3 deletions gratipay/models/team/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
from gratipay.billing.exchanges import MINIMUM_CHARGE
from gratipay.exceptions import InvalidTeamName
from gratipay.models import add_event
from gratipay.models.team import mixins
from postgres.orm import Model

from .available import Available
from .closing import Closing
from .membership import Membership
from .takes import Takes
from .tip_migration import TipMigration


# Should have at least one letter.
TEAM_NAME_PATTERN = re.compile(r'^(?=.*[A-Za-z])([A-Za-z0-9.,-_ ]+)$')
Expand All @@ -33,8 +38,7 @@ def slugize(name):
return slug


class Team(Model, mixins.Available, mixins.Closing, mixins.Membership, mixins.Takes,
mixins.TipMigration):
class Team(Model, Available, Closing, Membership, Takes, TipMigration):
"""Represent a Gratipay team.
"""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals


class AvailableMixin(object):
class Available(object):
"""Teams can make money available for their members to take.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from gratipay.models import add_event


class ClosingMixin(object):
class Closing(object):
"""This mixin implements team closing.
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from .takes import ZERO, PENNY


class MembershipMixin(object):
class Membership(object):
"""Teams may have zero or more members, who are participants that take money from the team.
"""

Expand Down
7 changes: 0 additions & 7 deletions gratipay/models/team/mixins/__init__.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
PENNY = D('0.01')


class TakesMixin(object):
class Takes(object):
""":py:class:`~gratipay.models.participant.Participant` s who are members
of a :py:class:`~gratipay.models.team.Team` may take money from the team
during :py:class:`~gratipay.billing.payday.Payday`. Only the team owner may
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals


class TipMigrationMixin(object):
class TipMigration(object):
"""This mixin provides tip migration for teams.
"""

Expand Down
3 changes: 1 addition & 2 deletions gratipay/wireup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@
from gratipay.models.community import Community
from gratipay.models.country import Country
from gratipay.models.exchange_route import ExchangeRoute
from gratipay.models.participant import Participant
from gratipay.models.participant.mixins import Identity
from gratipay.models.participant import Participant, Identity
from gratipay.models.team import Team
from gratipay.models import GratipayDB
from gratipay.security.crypto import EncryptingPacker
Expand Down
10 changes: 5 additions & 5 deletions tests/py/test_participant_identities.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from cryptography.fernet import InvalidToken
from gratipay.testing import Harness, P
from gratipay.models.participant.mixins import identity, Identity
from gratipay.models.participant.mixins.identity import _validate_info, rekey
from gratipay.models.participant.mixins.identity import ParticipantIdentityInfoInvalid
from gratipay.models.participant.mixins.identity import ParticipantIdentitySchemaUnknown
from gratipay.models.participant import identity
from gratipay.models.participant.identity import _validate_info, rekey
from gratipay.models.participant.identity import ParticipantIdentityInfoInvalid
from gratipay.models.participant.identity import ParticipantIdentitySchemaUnknown
from gratipay.security.crypto import EncryptingPacker, Fernet
from postgres.orm import ReadOnly
from psycopg2 import IntegrityError
Expand Down Expand Up @@ -148,7 +148,7 @@ def test_sii_validates_identity(self):
)

def test_sii_happily_overwrites_schema_name(self):
packed = Identity.encrypting_packer.pack({'name': 'Crusher'})
packed = identity.Identity.encrypting_packer.pack({'name': 'Crusher'})
self.db.run( "INSERT INTO participant_identities "
"(participant_id, country_id, schema_name, info) "
"VALUES (%s, %s, %s, %s)"
Expand Down
2 changes: 1 addition & 1 deletion tests/py/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from base64 import urlsafe_b64decode
from cryptography.fernet import Fernet, InvalidToken
from gratipay import security
from gratipay.models.participant.mixins import Identity
from gratipay.models.participant import Identity
from gratipay.security.crypto import EncryptingPacker
from gratipay.testing import Harness
from pytest import raises
Expand Down
4 changes: 2 additions & 2 deletions tests/py/test_team_membership.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

from test_team_takes import TeamTakesHarness, PENNY
from gratipay.models.team import mixins
from gratipay.models.team.membership import Membership


class Tests(TeamTakesHarness):
Expand All @@ -15,7 +15,7 @@ def assert_memberships(self, *expected):


def test_team_object_subclasses_takes_mixin(self):
assert isinstance(self.enterprise, mixins.Membership)
assert isinstance(self.enterprise, Membership)


# gm - get_memberships
Expand Down
2 changes: 1 addition & 1 deletion tests/py/test_team_takes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import absolute_import, division, print_function, unicode_literals

from pytest import raises
from gratipay.models.team.mixins.takes import NotAllowed, PENNY, ZERO
from gratipay.models.team.takes import NotAllowed, PENNY, ZERO
from gratipay.testing import Harness, D,P,T
from gratipay.testing.billing import PaydayMixin

Expand Down
2 changes: 1 addition & 1 deletion tests/py/test_tip_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest
from gratipay.testing import Harness
from gratipay.models.team.mixins.tip_migration import AlreadyMigrated, migrate_all_tips
from gratipay.models.team.tip_migration import AlreadyMigrated, migrate_all_tips


class Tests(Harness):
Expand Down
4 changes: 2 additions & 2 deletions tests/ttw/test_team_distributing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ def test_owner_can_add_a_member(self):
self.sign_in('picard')
self.visit('/TheEnterprise/distributing/')
self.css('.lookup-container .query').first.fill('alice')
time.sleep(0.2)
time.sleep(0.3)
self.css('.lookup-container button').first.click()
time.sleep(0.2)
time.sleep(0.3)
assert [a.text for a in self.css('table.team a')] == ['alice']


Expand Down
2 changes: 1 addition & 1 deletion www/%team/distributing/%to.json.spt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ from aspen import Response
from babel.numbers import NumberFormatError
from gratipay.utils import get_team
from gratipay.models.participant import Participant
from gratipay.models.team.mixins.takes import ZERO, PENNY
from gratipay.models.team.takes import ZERO, PENNY

[--------------------]
request.allow('POST')
Expand Down

0 comments on commit 22adf42

Please sign in to comment.