def test_init_custom_fields_individual(self, mocked_person_init): instance = MagicMock(INDIVIDUAL_TYPE="foo", get_type=MagicMock(return_value="foo")) Seller.init_custom_fields(instance) self.assertIsInstance(mocked_person_init, MagicMock) mocked_person_init.assert_called_once()
def test_init_custom_fields_business(self, mocked_address_from_dict, mocked_person_from_dict): instance = MagicMock(BUSINESS_TYPE="foo", get_type=MagicMock(return_value="foo")) Seller.init_custom_fields(instance) self.assertIsInstance(mocked_address_from_dict, MagicMock) self.assertIsInstance(mocked_person_from_dict, MagicMock) mocked_address_from_dict.assert_called_once() mocked_person_from_dict.assert_called_once()
def test_business_non_required_fields(self): self.assertIsSubSet( { "business_website", "business_description", "business_facebook", "business_twitter", "owner", }, Seller.get_business_non_required_fields(), )
def test_business_required_fields(self): self.assertEqual( { "business_address", "business_email", "business_name", "business_opening_date", "business_phone", "ein", }, Seller.get_business_required_fields(), )
def test_non_required_fields(self): self.assertIsSubSet( { "decline_on_fail_security_code", "decline_on_fail_zipcode", "is_mobile", "show_profile_online", "statement_descriptor", "terminal_code", "type", "merchant_code", "mcc", }, Seller.get_non_required_fields(), )
def test_individual_non_required_fields(self): self.assertIsSubSet({"website"}, Seller.get_individual_non_required_fields())
def test_individual_required_fields(self): self.assertIsSubSet(set(), Seller.get_individual_required_fields())
def test_required_fields(self): self.assertEqual(set(), Seller.get_required_fields())