def test_no_phone_number(self): input = {'name': 'John'} with self.assertRaises(exceptions.BadRequestException): citizens.create(input)
def test_good_creation(self, find_mock: mock.Mock): input = {'name': 'John', 'phone_number': '+31612345678'} output = citizens.create(input) self.assertDictEqual(output, input)
def test_phone_number_gets_formatted(self, find_mock: mock.Mock): input = {'name': 'John', 'phone_number': '06 123-45678'} expected = {'name': 'John', 'phone_number': '+31612345678'} output = citizens.create(input) self.assertDictEqual(output, expected)
def test_citizen_exists(self, find_mock: mock.Mock): input = find_mock.return_value with self.assertRaises(exceptions.AlreadyExistsException): citizens.create(input)