Added third group visibility state.

This commit is contained in:
akwizgran
2016-11-15 14:08:01 +00:00
parent 007df4288b
commit ec1f4dccdb
19 changed files with 563 additions and 408 deletions

View File

@@ -49,6 +49,7 @@ import static org.briarproject.api.blogs.BlogConstants.KEY_TYPE;
import static org.briarproject.api.blogs.MessageType.POST;
import static org.briarproject.api.identity.Author.Status.VERIFIED;
import static org.briarproject.api.identity.AuthorConstants.MAX_PUBLIC_KEY_LENGTH;
import static org.briarproject.api.sync.Group.Visibility.SHARED;
import static org.briarproject.blogs.BlogManagerImpl.CLIENT_ID;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -102,25 +103,18 @@ public class BlogManagerImplTest extends BriarTestCase {
will(returnValue(blog1.getAuthor()));
oneOf(blogFactory).createBlog(blog1.getAuthor());
will(returnValue(blog1));
oneOf(db).containsGroup(txn, blog1.getId());
will(returnValue(false));
oneOf(db).addGroup(txn, blog1.getGroup());
oneOf(db).getContacts(txn, blog1.getAuthor().getId());
will(returnValue(contactIds));
oneOf(db).setVisibleToContact(txn, contactId, blog1.getId(), true);
oneOf(db).getContacts(txn);
will(returnValue(contacts));
oneOf(blogFactory).createBlog(blog2.getAuthor());
will(returnValue(blog2));
oneOf(db).containsGroup(txn, blog2.getId());
will(returnValue(false));
oneOf(db).addGroup(txn, blog2.getGroup());
oneOf(db).setVisibleToContact(txn, contactId, blog2.getId(), true);
oneOf(db).getLocalAuthor(txn, blog1.getAuthor().getId());
oneOf(db).setGroupVisibility(txn, contactId, blog2.getId(), SHARED);
oneOf(identityManager).getLocalAuthor(txn);
will(returnValue(blog1.getAuthor()));
oneOf(blogFactory).createBlog(blog1.getAuthor());
will(returnValue(blog1));
oneOf(db).setVisibleToContact(txn, contactId, blog1.getId(), true);
oneOf(db).setGroupVisibility(txn, contactId, blog1.getId(), SHARED);
}});
blogManager.createLocalState(txn);