Beispiel #1
0
    def test_get_address_not_exist(self, mock_get_address, mock_abort):
        """Api should return information about address."""
        mock_get_address.return_value = None
        Address.get(1)

        mock_abort.assert_called_once_with(404,
                                           message="No such address with ID=1")
Beispiel #2
0
    def test_get_address(self, mock_get_address):
        """Api should return information about address."""
        mock_get_address.return_value = self.valid_test_data[0]
        response = Address.get(1)

        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.json['id'], self.valid_test_data[0]['id'])
        self.assertEqual(response.json['name'],
                         self.valid_test_data[0]['name'])
Beispiel #3
0
    def test_get_address_wrong_id_case2(self, mock_abort):
        """Api should return information about address."""
        Address.get(-1)

        mock_abort.assert_called_once_with(
            404, message="No such address with ID=-1")