Commit Graph

113 Commits

Author SHA1 Message Date
Aaron Lindsay e99abfe866 handlers: Cleanup Context, route handling code 2017-11-12 20:39:36 -05:00
Aaron Lindsay 507868b7a5 Begin move away from using http.ServeMux 2017-11-12 20:17:27 -05:00
Aaron Lindsay 9429b748fa Prefix all API endpoints with 'v1/', pluralize collections 2017-11-11 08:05:09 -05:00
Aaron Lindsay 79ed5dad9f testing: Test Lua Prices 2017-11-10 20:49:45 -05:00
Aaron Lindsay 9b1b682bac prices: Implement initial API and tests 2017-11-10 20:13:49 -05:00
Aaron Lindsay 7e728ff29b testing: Add initial testing of Lua balances 2017-11-08 20:46:13 -05:00
Aaron Lindsay bca3e3b408 Lua balances: Fix order of operands pulled in 2017-11-08 20:44:34 -05:00
Aaron Lindsay 5daed2f508 testing: Add tests for Lua dates
Also fix a timezone bug discovered while testing
2017-11-07 05:58:58 -05:00
Aaron Lindsay 6115a16f89 testing: Use a different date-creation format for one Lua accounts test 2017-11-06 21:22:01 -05:00
Aaron Lindsay 985270f190 testing: Test Lua accounts 2017-11-06 21:16:04 -05:00
Aaron Lindsay fb67ab586f testing: Add __eq and __tostring tests for Lua securities 2017-11-06 05:49:58 -05:00
Aaron Lindsay 6c18506432 testing: Separate out simple Lua testing 2017-11-06 05:37:52 -05:00
Aaron Lindsay c4ed7d3c50 testing: Test get_securities() Lua call 2017-11-05 21:25:20 -05:00
Aaron Lindsay 0dec4001eb testing: Test Lua securities 2017-11-05 20:53:20 -05:00
Aaron Lindsay 5dd27a6c56 Lua: Add Security.AlternateId getter 2017-11-05 20:52:36 -05:00
Aaron Lindsay f2a45dc6b6 Make SecurityType its own type 2017-11-05 20:43:32 -05:00
Aaron Lindsay 6fb66ac04e testing: Add initial report tabulation test 2017-11-03 22:13:20 -04:00
Aaron Lindsay 0863e5fa5c testing: Don't omit the 0th elements when testing 2017-11-03 20:54:17 -04:00
Aaron Lindsay 5504d37482 testing: Improve testing CRUD for reports
Ensure we don't get silent errors if the Lua code is longer than the
database column, don't leave out the first report from testing, test
fetching multiple reports.
2017-11-03 20:50:19 -04:00
Aaron Lindsay 72cbcca965 testing: Add RUD tests for reports 2017-11-02 21:20:43 -04:00
Aaron Lindsay 82362f7ebc testing: Use an in-memory sqlite3 database
This makes testing *much* faster and removes the need for creating
temporary directories
2017-11-01 21:09:55 -04:00
Aaron Lindsay 9cca8d1db6 accounts_test.go: Fix typo in failure message 2017-11-01 21:03:20 -04:00
Aaron Lindsay d3c03e4380 testing: Test creating reports 2017-11-01 21:03:07 -04:00
Aaron Lindsay 5b0b0bd03b testing: Ensure account versions increased when creating/deleting transactions 2017-11-01 05:59:16 -04:00
Aaron Lindsay e03944c80f testing: Ensure account versions are increased when modifying transactions 2017-11-01 05:44:40 -04:00
Aaron Lindsay 4963e473aa testing: Add files and line numbers to logging output 2017-10-31 21:04:03 -04:00
Aaron Lindsay 9721c04e52 testing: More thoroughly test fetching account transactions 2017-10-31 20:56:13 -04:00
Aaron Lindsay 8ba6a3dbf2 testing: Add initial account transactions test
Update one SQL query to do an 'INNER JOIN' instead of an 'IN' with a
subquery. This avoids error messages like:
  Error 1235: This version of MariaDB doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
2017-10-30 21:14:19 -04:00
Aaron Lindsay 3869f3a3b2 Get all current tests to pass with MySQL
This is done by requiring 'parseTime=true' in the MySQL DSN's (required
by github.com/go-sql-driver/mysql when Scan()ing to time.Time's), and
not forcing update counts to match if rows were updated to what they
already were.
2017-10-24 20:57:55 -04:00
Aaron Lindsay a1d294c309 securities: Allow SQL update count to be 0
MySQL reports 0 here, while sqlite reports 1. Improve the logged message
while we're at it.
2017-10-24 20:24:12 -04:00
Aaron Lindsay bcbb003e40 users: Simplify deletion of prices and splits owned by a user
The previous way was overly complex and didn't work with MySQL anyway
2017-10-24 20:13:42 -04:00
Aaron Lindsay 09a5cf9a99 testing: Test fetching all transactions 2017-10-23 21:14:19 -04:00
Aaron Lindsay 45b6482b15 testing: Test deleting transactions 2017-10-23 20:49:27 -04:00
Aaron Lindsay 9b00bc8db1 testing: Add more data 2017-10-23 20:10:00 -04:00
Aaron Lindsay 2246a4bff9 testing: Add more test data 2017-10-23 05:49:26 -04:00
Aaron Lindsay 5d50753bc8 testing: Ensure client CookieJar's aren't shared 2017-10-23 05:48:12 -04:00
Aaron Lindsay 96ede2a503 testing: Add more transactions tests 2017-10-23 05:47:51 -04:00
Aaron Lindsay 41fb459680 testing: Add tests for updating transactions/splits 2017-10-21 06:50:31 -04:00
Aaron Lindsay 2c85975e92 testing: Add test for fetching transactions/splits 2017-10-17 21:28:06 -04:00
Aaron Lindsay cdba839c66 testing: Add transaction-creation test 2017-10-16 05:39:41 -04:00
Aaron Lindsay af9371aeb9 Test not allowing users to be re-created with the same username 2017-10-14 20:47:57 -04:00
Aaron Lindsay 85a58c3ff8 go vet, go fmt 2017-10-14 20:38:40 -04:00
Aaron Lindsay 2ff1f47432 Remove duplicate *Tx versions of database access methods
Simplify naming to remove "Tx" now that all handlers only have access to
transactions anyway, and always use "tx" as the name of the variable
representing the SQL transactions (to make it less likely to cause
confusion with monetary transactions).
2017-10-14 19:41:13 -04:00
Aaron Lindsay 4e53a5e59c Use SQL transactions for the entirety of every request 2017-10-14 14:20:50 -04:00
Aaron Lindsay 6726d9cb2f testing: Test fetching all a user's accounts 2017-10-12 22:19:53 -04:00
Aaron Lindsay c26ce83aa3 testing: Test for and protect against circular accounts 2017-10-12 21:20:13 -04:00
Aaron Lindsay d5f8d57bf2 testing: Add tests for fetching multiple securities 2017-10-12 20:47:44 -04:00
Aaron Lindsay a399d75124 testing: Add account tests 2017-10-11 21:19:14 -04:00
Aaron Lindsay 52ee17dae8 testing: Add session deletion test 2017-10-11 05:49:41 -04:00
Aaron Lindsay e781e9861b sessions: Return deletion errors to user 2017-10-11 05:49:08 -04:00
Aaron Lindsay 3c5e726f93 testing: Error on teardown failures 2017-10-11 05:48:31 -04:00
Aaron Lindsay 14b0839b41 Add security tests 2017-10-09 21:11:50 -04:00
Aaron Lindsay 4953063286 testing: Make handlers.Error obey the standard 'error' interface
And return these types from test helper functions
2017-10-09 21:11:50 -04:00
Aaron Lindsay 32ac18647b testing: Add GET, DELETE, PUT helper functions too 2017-10-09 06:00:51 -04:00
Aaron Lindsay 2decf765ac testing: Add common way to POST objects 2017-10-08 21:18:30 -04:00
Aaron Lindsay bd52df65cd Create framework to automate creation/teardown of test data 2017-10-08 20:29:51 -04:00
Aaron Lindsay 3c6b5528f9 Delete everything when we delete a user 2017-10-07 21:04:59 -04:00
Aaron Lindsay 6e620fe713 Fix user deletion 2017-10-07 06:29:25 -04:00
Aaron Lindsay 8f0f64ae53 Add tests for users and sessions
Split out common test infrastructure from security_templates_test, make
tests HTTPS, use the http.Client provided by httptest
2017-10-07 06:21:05 -04:00
Aaron Lindsay 2fe25cbb77 Add negative security handler tests 2017-10-05 21:08:17 -04:00
Aaron Lindsay a6e2b33dd0 Add a test for limiting security templates returned 2017-10-05 08:42:19 -04:00
Aaron Lindsay e0ce1576cd Add first test
This tests only querying security templates, and not very exhaustively,
but it's a test!
2017-10-05 08:06:08 -04:00
Aaron Lindsay d0a5980b85 First pass at reorganizing go code into sub-packages 2017-10-04 19:35:59 -04:00