Skip to content

Commit

Permalink
add factories
Browse files Browse the repository at this point in the history
  • Loading branch information
Akuryou committed Dec 5, 2012
1 parent 6ad9f05 commit 737936b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions skrill/tests/factories.py
@@ -0,0 +1,24 @@
from decimal import Decimal
import random

from django.contrib.auth.models import User

import factory

from skrill.models import PaymentRequest
from skrill.settings import ISO4217


class UserFactory(factory.Factory):
FACTORY_FOR = User

username = factory.Sequence(lambda n: "Test User %s" % n)


class PaymentRequestFactory(factory.Factory):
FACTORY_FOR = PaymentRequest

user = UserFactory()
amount = Decimal(random.randrange(10000))/100
currency = random.choice(ISO4217)[0]

0 comments on commit 737936b

Please sign in to comment.