Created
February 26, 2018 01:09
-
-
Save codeadict/20d5be237c66cfc59b9250270e4be84e to your computer and use it in GitHub Desktop.
Unit tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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