Fixed bugs in unit tests from references to rmilk

pull/14/head
Sam Bosley 12 years ago
parent cae8c4eb35
commit 8bdcb8ef0f

@ -10,18 +10,19 @@ import java.io.IOException;
import org.apache.http.Header; import org.apache.http.Header;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.json.JSONArray; import org.json.JSONArray;
import org.weloveastrid.rmilk.MilkUtilities;
import com.todoroo.andlib.service.Autowired; import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.RestClient; import com.todoroo.andlib.service.RestClient;
import com.todoroo.astrid.dao.StoreObjectDao; import com.todoroo.astrid.dao.StoreObjectDao;
import com.todoroo.astrid.dao.StoreObjectDao.StoreObjectCriteria; import com.todoroo.astrid.dao.StoreObjectDao.StoreObjectCriteria;
import com.todoroo.astrid.gtasks.GtasksPreferenceService;
import com.todoroo.astrid.test.DatabaseTestCase; import com.todoroo.astrid.test.DatabaseTestCase;
import com.todoroo.astrid.utility.Constants; import com.todoroo.astrid.utility.Constants;
public class UpdateMessageServiceTest extends DatabaseTestCase { public class UpdateMessageServiceTest extends DatabaseTestCase {
@Autowired private StoreObjectDao storeObjectDao; @Autowired private StoreObjectDao storeObjectDao;
@Autowired private GtasksPreferenceService gtasksPreferenceService;
public void testNoUpdates() { public void testNoUpdates() {
clearLatestUpdates(); clearLatestUpdates();
@ -148,25 +149,25 @@ public class UpdateMessageServiceTest extends DatabaseTestCase {
public void testUpdateWithInternalPluginOn() { public void testUpdateWithInternalPluginOn() {
clearLatestUpdates(); clearLatestUpdates();
MilkUtilities.INSTANCE.setToken("milk"); gtasksPreferenceService.setToken("gtasks");
new TestUpdateMessageService() { new TestUpdateMessageService() {
@Override @Override
void verifyMessage(MessageTuple message) { void verifyMessage(MessageTuple message) {
assertTrue(message.message.toString().contains("rmilk man")); assertTrue(message.message.toString().contains("gtasks man"));
} }
@Override @Override
String getUpdates(String url) throws IOException { String getUpdates(String url) throws IOException {
return "[{message:'rmilk man',plugin:'rmilk'}]"; return "[{message:'gtasks man',plugin:'gtasks'}]";
} }
}.processUpdates(); }.processUpdates();
} }
public void testUpdateWithInternalPluginOff() { public void testUpdateWithInternalPluginOff() {
clearLatestUpdates(); clearLatestUpdates();
MilkUtilities.INSTANCE.setToken(null); gtasksPreferenceService.setToken(null);
new TestUpdateMessageService() { new TestUpdateMessageService() {
@ -182,7 +183,7 @@ public class UpdateMessageServiceTest extends DatabaseTestCase {
@Override @Override
String getUpdates(String url) throws IOException { String getUpdates(String url) throws IOException {
return "[{message:'rmilk man',plugin:'rmilk'}]"; return "[{message:'gtasks man',plugin:'gtasks'}]";
} }
}.processUpdates(); }.processUpdates();
} }

@ -409,16 +409,6 @@ public class Astrid2To3UpgradeTests extends DatabaseTestCase {
// verify that data exists in our new table // verify that data exists in our new table
database.openForReading(); database.openForReading();
TodorooCursor<Metadata> cursor = metadataDao.query(Query.select(
Metadata.PROPERTIES).where(MetadataCriteria.withKey("rmilk")));
assertEquals(1, cursor.getCount());
cursor.moveToFirst();
Metadata metadata = new Metadata(cursor);
assertEquals("123", metadata.getValue(Metadata.VALUE1));
assertEquals("456", metadata.getValue(Metadata.VALUE2));
assertEquals("789000", metadata.getValue(Metadata.VALUE3));
cursor.close();
} }

Loading…
Cancel
Save