def fetch_by_account_number(self, account_number):
        doc_ref = self.account_repo.document(account_number)
        doc = doc_ref.get()

        account_json = doc.to_dict()
        if account_json is not None:
            return Account(account_number=account_json["account_number"],
                           account_status=account_json["account_status"],
                           customer_id=account_json["customer_id"])
        else:
            raise AccountNotFound()
def test_get_accounts_by_number_when_account_does_not_exist(
        get_account, web_client):
    get_account.side_effect = AccountNotFound()

    bad_account_number = '11111111'
    response = web_client.get(f'/accounts/{bad_account_number}')

    expected_json = {'message': 'Not found'}

    assert response.status_code == 404
    assert response.is_json
    assert response.get_json() == expected_json