Skip to content

Commit

Permalink
Merge pull request #9 from rapidpro/test_fixes
Browse files Browse the repository at this point in the history
Update tests to latest RapidPro db schema
  • Loading branch information
rowanseymour authored Sep 14, 2016
2 parents df76c31 + c03cf9d commit 4eb1f37
Show file tree
Hide file tree
Showing 5 changed files with 2,853 additions and 578 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/rapidpro/mage/dao/MessageDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int insertIncoming(@Bind("channelId") Integer channelId,
* @param messageIds the message ids
* @param dates the delivered on dates
*/
@SqlBatch("UPDATE " + Table.MESSAGE + " SET status = 'D', delivered_on = :deliveredOn WHERE id = :messageId")
@SqlBatch("UPDATE " + Table.MESSAGE + " SET status = 'D', modified_on = :deliveredOn WHERE id = :messageId")
void updateBatchToDelivered(@Bind("messageId") Iterable<Integer> messageIds, @Bind("deliveredOn") Iterable<Date> dates);

/**
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/io/rapidpro/mage/dao/MessageDaoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ public void updateBatchToDelivered_shouldUpdateAllWiredMessages() throws Excepti

Map<String, Object> message1 = fetchSingleById(Table.MESSAGE, -81);
assertThat(message1, hasEntry("status", "D"));
assertThat(message1, hasEntry("delivered_on", d1));
assertThat(message1, hasEntry("modified_on", d1));
Map<String, Object> message2 = fetchSingleById(Table.MESSAGE, -82);
assertThat(message2, hasEntry("status", "D"));
assertThat(message2, hasEntry("delivered_on", d2));
assertThat(message2, hasEntry("modified_on", d2));
Map<String, Object> message3 = fetchSingleById(Table.MESSAGE, -83);
assertThat(message3, hasEntry("status", "D"));
assertThat(message3, hasEntry("delivered_on", d3));
assertThat(message3, hasEntry("modified_on", d3));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public void doUnitOfWork_shouldUpdateStatuses() throws Exception {
Map<String, Object> message1 = fetchSingleById(Table.MESSAGE, -81);
assertThat(message1.get("status"), is("S"));
assertThat(message1.get("sent_on"), is(date1));
assertThat(message1.get("delivered_on"), nullValue());
assertThat(message1.get("modified_on"), nullValue());

Map<String, Object> message2 = fetchSingleById(Table.MESSAGE, -82);
assertThat(message2.get("status"), is("D"));
assertThat(message2.get("sent_on"), is(TestUtils.date("2014-01-22 23:26:02.181")));
assertThat(message2.get("delivered_on"), is(date2));
assertThat(message2.get("modified_on"), is(date2));

Map<String, Object> message3 = fetchSingleById(Table.MESSAGE, -83);
assertThat(message3.get("status"), is("F"));
Expand Down
Loading

0 comments on commit 4eb1f37

Please sign in to comment.