Files @ 281d6fed47b7
Branch filter:

Location: NPO-Accounting/experimental-accounting-api/tests/post-transactions.json

Joar Wandborg
[test] Added unit tests

- Moved the TransactionNotFound exception to a more appropriate place.
- Changed the serialization for AccountingExceptions
- Override the Exception.__init__ method in AccountingException
- Added __eq__ methods to accounting.models.*
- Catch the TransactionNotFound exception in transaction_get and return a
404 instead. This could be improved, perhaps in the jsonify_exceptions
decorator so that all endpoints that raise a TransactionNotFound
exception automatically return a 404.
{
  "transactions": [
    {
      "__type__": "Transaction",
      "date": "2013-01-01",
      "payee": "Kindly T. Donor",
      "postings": [
        {
          "__type__": "Posting",
          "account": "Income:Foo:Donation",
          "amount": {
            "__type__": "Amount",
            "amount": "-100",
            "symbol": "$"
          }
        },
        {
          "__type__": "Posting",
          "account": "Assets:Checking",
          "amount": {
            "__type__": "Amount",
            "amount": "100",
            "symbol": "$"
          }
        }
      ]
    },
    {
      "__type__": "Transaction",
      "date": "2013-03-15",
      "payee": "Another J. Donor",
      "postings": [
        {
          "__type__": "Posting",
          "account": "Income:Foo:Donation",
          "amount": {
            "__type__": "Amount",
            "amount": "-400",
            "symbol": "$"
          }
        },
        {
          "__type__": "Posting",
          "account": "Assets:Checking",
          "amount": {
            "__type__": "Amount",
            "amount": "400",
            "symbol": "$"
          }
        }
      ]
    }
  ]
}