Skip to content

Instantly share code, notes, and snippets.

@codeadict
Created February 26, 2018 01:09
Show Gist options
  • Save codeadict/20d5be237c66cfc59b9250270e4be84e to your computer and use it in GitHub Desktop.
Save codeadict/20d5be237c66cfc59b9250270e4be84e to your computer and use it in GitHub Desktop.
Unit tests
import unittest
from faker import Faker
from customer import Customer
class TestCustomer(unittest.TestCase):
def setUp(self):
fake = Faker()
self.customer = Customer(
name = fake.company(),
address = fake.street_address(),
state = fake.state(),
zipcode = fake.zipcode(),
contact_name = fake.name_female(),
phone_number = fake.phone_number(),
email = fake.company_email(),
notes = fake.text(max_nb_chars=20)
)
def test_full_address(self):
expected = f'{self.customer.address} {self.customer.state} {self.customer.zipcode}'
self.assertEqual(expected, self.customer.full_address)
def test_contact(self):
expected = f'{self.customer.contact_name} <self.customer.email>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment