Skip to content

Commit

Permalink
Merge pull request #7 from Shin--/master
Browse files Browse the repository at this point in the history
Specified readonly_fields for django admin
  • Loading branch information
ceata authored Oct 25, 2019
2 parents a70b799 + b410c35 commit b7639f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 32 deletions.
1 change: 1 addition & 0 deletions django_sofortueberweisung/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ class SofortTransactionAdmin(admin.ModelAdmin):
list_filter = ('status', 'status_reason')
ordering = ('-created_at',)
fields = ('transaction_id', 'created_at', 'last_modified', 'status', 'status_reason')
readonly_fields = ['created_at', 'last_modified']

admin.site.register(SofortTransaction, SofortTransactionAdmin)
37 changes: 5 additions & 32 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@

from __future__ import unicode_literals

import os, sys
import re
import xmltodict
from requests import Response
from testfixtures import replace
import sys

import xmltodict
from django.conf.urls import include, url
from django.test import Client, TestCase
from requests import Response
from testfixtures import replace

from django_sofortueberweisung import settings as django_sofortueberweisung_settings
from django_sofortueberweisung.models import SofortTransaction
from django_sofortueberweisung.wrappers import SofortWrapper, DjangoSofortError

from django_sofortueberweisung.wrappers import SofortWrapper
from .test_response_mockups import TEST_RESPONSES

try:
Expand Down Expand Up @@ -153,34 +152,8 @@ def test_known_transaction_refund_error(self):
self.assertGreaterEqual(refund.errors.count(), 1)
self.assertTrue(refund.errors.filter(error_code='5003'))


def _create_test_transaction(self, transaction_id):
return SofortTransaction.objects.create(
transaction_id=transaction_id,
payment_url='https://www.sofort.com/payment/go/'+transaction_id
)


class TestSofortTransactions(TestCase):
auth = {
'PROJECT_ID': '299010',
'USER': '135335',
'API_KEY': 'aeb2075b1455a8ce874749e973e61cca',
}
cafile = os.path.join(os.path.abspath(os.path.join(os.path.abspath(os.path.dirname(os.path.dirname(__file__))), 'django_sofortueberweisung')), 'cacert.pem')

def test_valid_transaction(self):
sofort_wrapper = SofortWrapper(auth=self.auth)
sofort_transaction = sofort_wrapper.init(
amount=1.0,
email_customer='[email protected]',
phone_customer=None,
user_variables=None,
sender='Test',
reasons=['Just a test.'],
currency_code='EUR'
)
self.assertEqual(sofort_transaction.status, '')
# TODO: let the transaction be accepted by sofort.com
# TODO: let the transaction be refunded by sofort.com
self.assertFalse(sofort_transaction.refresh_from_sofort(sofort_wrapper=sofort_wrapper))

0 comments on commit b7639f7

Please sign in to comment.