Skip to content

Commit

Permalink
Initial passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brylie committed Jun 21, 2023
1 parent 0f6f8fa commit c9c03c5
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion addresses/tests.py
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
# Create your tests here.
from django.test import SimpleTestCase
from .models import Address


class TestAddress(Address):
pass


class AddressSimpleTestCase(SimpleTestCase):
def test_address_str_formatting(self) -> None:
address = TestAddress()

# Address string should default to United States
self.assertEqual(str(address), "")

address.street_address = "123 Main St."
self.assertEqual(str(address), "123 Main St.")

address.locality = "Anytown"
self.assertEqual(str(address), "123 Main St., Anytown")

address.region = "CA"
self.assertEqual(str(address), "123 Main St., Anytown, CA")

address.postal_code = "12345"
self.assertEqual(str(address), "123 Main St., Anytown, CA, 12345")

address.country = "United States"
self.assertEqual(
str(address), "123 Main St., Anytown, CA, 12345, United States"
)

0 comments on commit c9c03c5

Please sign in to comment.