Skip to content
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
22 changes: 0 additions & 22 deletions instadealz/migrations/0001_initial.py

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions instadealz/migrations/0003_alter_product_image.py

This file was deleted.

Empty file removed instadealz/migrations/__init__.py
Empty file.
36 changes: 32 additions & 4 deletions instadealz/tests.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,37 @@
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from instadealz.models import Product


# Create your tests here.
class ProductTests(TestCase):
@classmethod
def setUpTestData(cls):
testuser1 = get_user_model().objects.create_user(username='testuser', password='pass')
testuser1.save()

test_product = Product.objects.create(name='rake', owner=testuser1,description='Better for collecting leaves than a shovel.')
test_product.save()

def test_product_model(self):
product = Product.objects.get(id=1)
actual_owner = str(product.owner)
actual_name = str(product.name)
actual_description = str(product.description)
self.assertEqual(actual_owner,'testuser')
self.assertEqual(actual_name, 'rake')
self.assertEqual(actual_description,'Better for collecting leaves than a shovel.')

def test_list_page_status_code(self):
url = reverse("product_list")
response = self.client.get(url)
self.assertEqual(response.status_code, 200)

def test_detail_page_status_code(self):
url = reverse("product_detail")
response = self.client.get(url)
self.assertEqual(response.status_code, 200)



class InstadealzTests(TestCase):
# TODO: test your app
def test_your_app(self):
self.assertEqual("I have many tests", "I have many tests")
4 changes: 4 additions & 0 deletions project/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
https://docs.djangoproject.com/en/4.0/ref/settings/
"""


import os
from pathlib import Path
import environ


# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent

Expand Down Expand Up @@ -107,6 +110,7 @@
"PASSWORD": env.str("DATABASE_PASSWORD"),
"HOST": env.str("DATABASE_HOST"),
"PORT": env.int("DATABASE_PORT"),

}
}

Expand Down