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 Inventory model #20

Open
wants to merge 3 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
1 change: 0 additions & 1 deletion web_server/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ django = "*"
python-dotenv = "*"
pygithub = "*"

[requires]
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.

2 changes: 1 addition & 1 deletion web_server/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
execute_from_command_line(sys.argv)
7 changes: 7 additions & 0 deletions web_server/web_server/models/Inventory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from django.db import models

class Inventory(models.Model):
id = models.IntegerField(primary_key=True)
machine = models.IntegerField()
item = models.IntegerField()
#transaction = models.idField(id, on__delete=models.CASCADE)
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 .Inventory import Inventory
17 changes: 17 additions & 0 deletions web_server/web_server/tests/test_model_inventory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from django.test import TestCase
from web_server.models import Inventory

class InventoryTest(TestCase):

def create_inventory(candy, id=123, machine=456, item=789):
return Inventory.objects.create(id=id,machine=machine,item=item)

def test_inventory_creation(candy):
c1 = candy.create_inventory()
c2 = candy.create_inventory(id=321)

candy.assertEqual(123,c1.id)
candy.assertEqual(321,c2.id)

candy.assertEqual(456,c1.machine)
candy.assertEqual(456,c2.machine)