Skip to content

Commit

Permalink
add test user model to resolve test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
nicmollel-ro committed Jun 18, 2024
1 parent deddc62 commit 7e8fa85
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aa_stripe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def charge(self, idempotency_key=None, payment_uuid=None):
"object_id": self.object_id,
"content_type_id": self.content_type_id,
"member_uuid": str(self.user.uuid),
"custody": "roman_api",
"origin": "roman_api",
}
if payment_uuid:
metadata["payment_uuid"] = str(payment_uuid)
Expand Down
7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ def pytest_configure():
"django.contrib.admin",
"django.contrib.sites",
"rest_framework",
"aa_stripe"
"aa_stripe",
"tests",
),
AUTH_USER_MODEL="tests.TestUser",
ROOT_URLCONF="aa_stripe.api_urls",
TESTING=True,

ENV_PREFIX="test-env",
STRIPE_SETTINGS_API_KEY="apikey",
STRIPE_SETTINGS_WEBHOOK_ENDPOINT_SECRET="fake"
STRIPE_SETTINGS_WEBHOOK_ENDPOINT_SECRET="fake",
)
8 changes: 8 additions & 0 deletions tests/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import uuid

from django.contrib.auth.models import AbstractUser
from django.db import models


class TestUser(AbstractUser):
uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
2 changes: 2 additions & 0 deletions tests/test_charge.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def test_charge_with_idempotency_key(self, charge_create_mocked):
metadata={
"object_id": self.charge.object_id,
"content_type_id": self.charge.content_type_id,
"origin": "roman_api",
"member_uuid": str(self.user.uuid),
},
)

Expand Down

0 comments on commit 7e8fa85

Please sign in to comment.