use of it.niedermann.owncloud.notes.persistence.entity.Account in project nextcloud-notes by stefan-niedermann.
the class NotesDaoTest method getFavoritesCount.
@Test
public void getFavoritesCount() throws InterruptedException {
final Account secondAccount = setupSecondAccountAndTestNotes();
assertEquals(Integer.valueOf(1), db.getNoteDao().countFavorites(account.getId()));
assertEquals(Integer.valueOf(1), db.getNoteDao().countFavorites(secondAccount.getId()));
assertEquals(Integer.valueOf(1), NotesTestingUtil.getOrAwaitValue(db.getNoteDao().countFavorites$(account.getId())));
assertEquals(Integer.valueOf(1), NotesTestingUtil.getOrAwaitValue(db.getNoteDao().countFavorites$(secondAccount.getId())));
}
use of it.niedermann.owncloud.notes.persistence.entity.Account in project nextcloud-notes by stefan-niedermann.
the class NotesRepositoryTest method updateDisplayName.
@Test
public void updateDisplayName() {
final var account = db.getAccountDao().getAccountById(db.getAccountDao().insert(new Account("https://äöüß.example.com", "彼得", "彼得@äöüß.example.com", null, new Capabilities())));
assertEquals("Should read userName in favor of displayName if displayName is NULL", "彼得", account.getDisplayName());
repo.updateDisplayName(account.getId(), "");
assertEquals("Should properly update the displayName, even if it is blank", "", db.getAccountDao().getAccountById(account.getId()).getDisplayName());
repo.updateDisplayName(account.getId(), "Foo Bar");
assertEquals("Foo Bar", db.getAccountDao().getAccountById(account.getId()).getDisplayName());
repo.updateDisplayName(account.getId(), null);
assertEquals("Should read userName in favor of displayName if displayName is NULL", "彼得", db.getAccountDao().getAccountById(account.getId()).getDisplayName());
}
use of it.niedermann.owncloud.notes.persistence.entity.Account in project nextcloud-notes by stefan-niedermann.
the class NotesRepositoryTest method testAddAccount.
@Test
public void testAddAccount() throws IOException {
NotesTestingUtil.mockSingleSignOn(new SingleSignOnAccount("彼得@äöüß.example.com", "彼得", "1337", "https://äöüß.example.com", ""));
repo.addAccount("https://äöüß.example.com", "彼得", "彼得@äöüß.example.com", new Capabilities(), "", new IResponseCallback<>() {
@Override
public void onSuccess(Account createdAccount) {
assertEquals("https://äöüß.example.com", createdAccount.getUrl());
assertEquals("彼得", createdAccount.getUserName());
assertEquals("彼得@äöüß.example.com", createdAccount.getAccountName());
}
@Override
public void onError(@NonNull Throwable t) {
fail(t.getMessage());
}
});
}
use of it.niedermann.owncloud.notes.persistence.entity.Account in project nextcloud-notes by stefan-niedermann.
the class AccountDaoTest method insertAccount.
@Test
public void insertAccount() {
final long createdId = db.getAccountDao().insert(new Account("https://äöüß.example.com", "彼得", "彼得@äöüß.example.com", null, new Capabilities()));
final var createdAccount = db.getAccountDao().getAccountById(createdId);
assertEquals("https://äöüß.example.com", createdAccount.getUrl());
assertEquals("彼得", createdAccount.getUserName());
assertEquals("彼得@äöüß.example.com", createdAccount.getAccountName());
}
use of it.niedermann.owncloud.notes.persistence.entity.Account in project nextcloud-notes by stefan-niedermann.
the class AccountDaoTest method updateApiVersionFromNull.
@Test
public void updateApiVersionFromNull() {
final var account = db.getAccountDao().getAccountById(db.getAccountDao().insert(new Account("https://äöüß.example.com", "彼得", "彼得@äöüß.example.com", null, new Capabilities())));
assertNull(account.getApiVersion());
assertEquals(0, db.getAccountDao().updateApiVersion(account.getId(), null));
assertEquals(1, db.getAccountDao().updateApiVersion(account.getId(), "[0.2]"));
assertEquals(0, db.getAccountDao().updateApiVersion(account.getId(), "[0.2]"));
}
Aggregations