Commit graph

67 commits

Author SHA1 Message Date
Bradley M. Kuhn
3ff735584c This test did not belong here.
I believe this was due to a bad cut-and-paste in a previous commit.
2015-12-20 17:05:20 -08:00
Bradley M. Kuhn
6307cfdd26 Fix typos in the test message descriptions. 2015-12-20 16:59:29 -08:00
Bradley M. Kuhn
ef7a4ecc49 Add blank line. 2015-12-20 16:58:42 -08:00
Bradley M. Kuhn
4f42fe50d2 Test have today in UTC
It seems that date('now'), at least in sqlite, is in UTC.  So, we want
the tests to match that.

There are still timing bugs possible here, but with this change, they
should only occur if you run the test right at 23:58 or 23:59 UTC. :)
2015-12-20 16:39:00 -08:00
Bradley M. Kuhn
c8bbcc05e4 Parameter here is "notes", not "note" 2015-12-20 15:15:39 -08:00
Bradley M. Kuhn
da396611fc Correct description string of this test. 2015-12-20 15:13:42 -08:00
Bradley M. Kuhn
e0f7e66bba getReqeust: don't use paramater has setup.
We don't really need lookup based on requestTypeId for this anyway, so
this method really only needs two arguments (perhaps a third optional
argument to be added later).
2015-12-20 14:22:46 -08:00
Bradley M. Kuhn
ccfa057cce Fix my bad spelling: fufill -> fulfill 2015-12-20 14:01:15 -08:00
Bradley M. Kuhn
84f81b4dd3 fulfillRequest: Behavior for "refill" request
When a request is already fulfilled, fulfillRequest() should return the
record that was found for the previous fulfillment.
2015-12-20 13:50:06 -08:00
Bradley M. Kuhn
3afe947cdd fufillRequest: parameter checks.
Parameter check tests now pass:

ok 66 - fufillRequest: dies if supporterId not specified
ok 67 - fufillRequest: dies if supporterId not found in database
ok 68 - fufillRequest: dies if requestType not specified
ok 69 - fufillRequest: who not specified

Also added new test.
2015-12-20 13:46:45 -08:00
Bradley M. Kuhn
1d83205949 fufillRequest: more tests. 2015-12-20 13:36:56 -08:00
Bradley M. Kuhn
075d7998d8 addRequest: Two additional tests. 2015-12-20 13:30:33 -08:00
Bradley M. Kuhn
d654622ebe We've already done one ResetDB above.
So make sure we're reseting the right DB
2015-12-20 12:45:43 -08:00
Bradley M. Kuhn
49273ecbde Be sure DESTROY is called, etc. 2015-12-20 12:45:36 -08:00
Bradley M. Kuhn
17c0f38639 Correct test: wrong comparison.
It was comparing a request_id to a request_type_id.  That is herein corected.
2015-12-20 12:45:15 -08:00
Bradley M. Kuhn
5cc564202e Remove debugging print in tests. 2015-12-20 12:11:42 -08:00
Bradley M. Kuhn
5e03ffd74d _getOrCreateRequestConfiguration:Refine unit tests
The unit tests had some bugs, which are herein fixed.
2015-12-20 12:09:52 -08:00
Bradley M. Kuhn
4ef9b9634a Improve test string here. 2015-12-20 11:12:46 -08:00
Bradley M. Kuhn
fc2250203d _getOrCreateRequestConfiguration: Additional test.
This additional test makes sure that it still fails a previous condition
when the requestTypeId is correct.
2015-12-20 11:12:12 -08:00
Bradley M. Kuhn
9dcea735f4 _verifyRequestTypeId: Implementation & unit tests.
Straightforward helper method.
2015-12-20 11:07:06 -08:00
Bradley M. Kuhn
1c33f4cbba _getOrCreateRequestConfiguration: Basic unit tests
This also required resetting the database in an earlier portion of the
tests than previous.
2015-12-20 10:58:22 -08:00
Bradley M. Kuhn
8876808aec Corrected some tests for _getOrCreateRequestType() 2015-12-17 20:15:09 -08:00
Bradley M. Kuhn
e2a63b30fa Tests for _getOrCreateRequestType
This is an internal helper function that I will need will implementing
the others.
2015-12-17 19:41:21 -08:00
Bradley M. Kuhn
2e2798459c Tests relating to requests, which spec out API.
This specs out the API for for addRequest(), getRequest(), and
fufillRequest().  These tests explain the basics of how they should
work.
2015-12-17 18:58:28 -08:00
Bradley M. Kuhn
6e57396399 Correct test that now fails after recent changes.
This test now started failing after the other corrections made in the
last few commits.

As it turns out, this test was buggy.  We wanted to test a request_type
that didn't exist, and verify that calls to addRequestConfigurations
with bad arguments didn't create the request_type if it didn't already
existed.  That's what the test now does.
2015-12-16 20:16:26 -08:00
Bradley M. Kuhn
fd85bb68f5 Remove blank line. 2015-12-16 20:13:32 -08:00
Bradley M. Kuhn
aef01b3031 new: Implement verification of $dbh
The two previously committed tests now pass:

ok 2 - new: dies when dbh is undefined.
ok 3 - new: dies when dbh is blessed into another module.
2015-12-16 19:25:20 -08:00
Bradley M. Kuhn
470b889c3e new: Tests verify $dbh is a valid database handle
These tests ensure new() method checks to see if you're really giving a
DBI class member as the first argument.
2015-12-16 19:21:01 -08:00
Bradley M. Kuhn
9417690277 Fix typo from last commit. 2015-12-16 18:42:59 -08:00
Bradley M. Kuhn
5d8d480223 Begin implementation of addPostalAddress.
These tests mostly fail, although a few pass automatically:

not ok 26 - addPostalAddress: dies for undefined id
not ok 27 - addPostalAddress: dies for non-numeric id
not ok 28 - addPostalAddress: postal address undefined fails
ok 29 - addPostalAddress: type is not added when other input paramaters are invalid
ok 30 - addPostalAddress: addPostalAddress of a valid formatted_address works.
ok 30 - addPostalAddress: addPostalAddress of a valid formatted_address works.
not ok 31 - addPostalAddress: id returned is sane.

Goal is to implement those and make sure they all pass.
2015-12-16 18:36:47 -08:00
Bradley M. Kuhn
bb84d6ad31 Minor documentation correction. 2015-12-16 18:25:07 -08:00
Bradley M. Kuhn
74146a15c9 Disconnect from this database handle too. 2015-12-14 17:28:36 -08:00
Bradley M. Kuhn
159d3d6609 Also verify it's a HASH reftype. 2015-12-14 17:28:19 -08:00
Bradley M. Kuhn
2950067c63 bug in tests found with transaction ref counting
Now that we are properly nesting transactions, this test is shown to be
incorrect.  Namely, it is indeed correct that the entire add should fail
when we've given something invalid: we don't want to add the requestType
if it wasn't already there if the parameter to add
addRequestConfigurations was invalid.
2015-12-14 17:25:02 -08:00
Bradley M. Kuhn
6b8d79553b Test various database integrity questions.
This new section of tests verifies that when the database disappears
underneath or has other types of problems that the API still functions
as expected.

The second test committed herein currently fails.
2015-12-14 17:05:42 -08:00
Bradley M. Kuhn
6bbb59c36a Test to verify email address mapping created.
This currently fails; addSupporter() must be corrected.
2015-12-14 16:43:47 -08:00
Bradley M. Kuhn
69945c2704 Implementation of getRequestConfigurations
A basic implementation of getRequestConfigurations and tests to go with
it.

Also added here is the test to verify that no items are added when
duplicates are included.
2015-12-13 14:06:22 -08:00
Bradley M. Kuhn
4331093cee Basic implementation of addRequestConfigurations
Adjusted one test slightly: there was a missing argument.  Also,
corrected test count.

While implementing, I realized a failure mode that forces a rollback:
duplication on the input list of configurations.  Tests are now needed
for that.
2015-12-13 13:37:52 -08:00
Bradley M. Kuhn
63af394ca6 Tests for an operation addRequestConfigurations
These tests currently fail; will write code next.
2015-12-13 13:28:38 -08:00
Bradley M. Kuhn
ae9685d16b Automatically call test suite on Emacs M-x compile 2015-12-13 13:04:53 -08:00
Bradley M. Kuhn
735db56d47 Begin implementation of addRequestConfigurations
Includes some modifications to reuse data from previous tests.
2015-12-13 13:04:27 -08:00
Bradley M. Kuhn
8fd03e8e6f Fail causes on getRequestConfigurations. 2015-12-13 12:50:08 -08:00
Bradley M. Kuhn
b5954e391e Correct test to actually test not-found case.
It was always going to pass no matter what the other way it was written.
2015-12-13 12:32:36 -08:00
Bradley M. Kuhn
4df468bb1b New test for addSupporter's addEmailAddress call 2015-12-13 12:31:54 -08:00
Bradley M. Kuhn
19d513280f addRequestType and getRequestType methods.
Including tests for both.
2015-12-13 12:16:14 -08:00
Bradley M. Kuhn
b34de3c1da Verify email address format with external module. 2015-12-11 18:32:59 -08:00
Bradley M. Kuhn
9e2359ed72 Test to verify addEmailAddress returns a valid id. 2015-12-11 18:23:24 -08:00
Bradley M. Kuhn
b1436e037e addEmailAddress: call addAddressType underneath
address_type is added automatically from the addEmailAddress call.
Since addAddressType does a lookup first, this should not cause
duplicates.
2015-12-09 19:56:22 -08:00
Bradley M. Kuhn
63383eef02 Correct messages. 2015-12-09 19:53:20 -08:00
Bradley M. Kuhn
d059523830 Make variable name more descriptive. 2015-12-09 19:52:31 -08:00