def test_fullname_concatenates_first_and_last_name_for_individuals(): identity = IdentityCard(id="...", type=IdentityCard.INDIVIDUAL, firstName="Rebecca Ann", lastName="Maloy") assert_that(identity.full_name, equal_to("Rebecca Ann Maloy"), "The full name")
def test_creates_identity(): identity = IdentityCard(firstName="the first name", lastName="the last name", mainName="the main name", dateOfBirth="1968", dateOfDeath="1998", type="the type", id="0000112345", works=[{ "title": "the title", "subtitle": "the subtitle" }]) assert_that( identity, has_properties(first_name="the first name", last_name="the last name", main_name="the main name", date_of_birth="1968", date_of_death="1998", type="the type", id="0000112345", works=contains( has_properties(title="the title", subtitle="the subtitle"))))
def john_roney(): return IdentityCard(id="9876543210000000", type=IdentityCard.INDIVIDUAL, firstName="John", lastName="Roney", dateOfBirth="1700", dateOfDeath="2500", works=[{ "title": "Zumbar" }])
def joel_miller(): return IdentityCard(id="0000000123456789", type=IdentityCard.INDIVIDUAL, firstName="Joel", lastName="Miller", dateOfBirth="1969", dateOfDeath="2100", works=[{ "title": "Chevere!" }])
def test_returns_the_longest_work_title(): identity = IdentityCard(id="...", type=IdentityCard.INDIVIDUAL, works=[{ "title": "title 1" }, { "title": "title 12", "subtitle": "with subtitle" }]) assert_that(identity.longest_title, equal_to("title 12 with subtitle"))
def test_returns_empty_string_when_works_is_empty(): identity = IdentityCard(id="...", type=IdentityCard.INDIVIDUAL) assert_that(identity.longest_title, equal_to(""))
def test_fullname_return_main_name_for_organisations(): identity = IdentityCard(id="...", type=IdentityCard.ORGANIZATION, mainName="The beatles") assert_that(identity.full_name, equal_to("The beatles"), "The full name")