Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Transaction Model #22

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions web_server/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions web_server/web_server/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
from .Doggo import Doggo
from .Owner import Owner
from .transaction import transaction
9 changes: 9 additions & 0 deletions web_server/web_server/models/transaction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from django.db import models
from django.utils import timezone

class transaction(models.Model):
# do stuff
user_id = models.IntegerField()
user = models.IntegerField()
timestamp = models.DateField(default=timezone.now())
# test
19 changes: 19 additions & 0 deletions web_server/web_server/tests/test_model_transaction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from django.test import TestCase
from web_server.models import transaction
#import datetime
from django.utils import timezone

class TransactionTest(TestCase):

def create_transaction(self, user_id=12345678, user=1):
return transaction.objects.create(user_id=user_id, user=user)

def test_transaction_creation(self):
o1 = self.create_transaction()
o2 = self.create_transaction(user_id=10000000, user=2)

self.assertEqual(12345678, o1.user_id)
self.assertEqual(10000000, o2.user_id)

self.assertEqual(1, o1.user)
self.assertEqual(2, o2.user)