mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 20:29:52 +01:00
Merge branch '962-check-blog-subscription-when-removing-contact' into 'master'
Check personal blog subscription when removing contact See merge request !549
This commit is contained in:
@@ -116,7 +116,7 @@ class BlogManagerImpl extends BdfIncomingMessageHook implements BlogManager,
|
|||||||
@Override
|
@Override
|
||||||
public void removingContact(Transaction txn, Contact c) throws DbException {
|
public void removingContact(Transaction txn, Contact c) throws DbException {
|
||||||
Blog b = blogFactory.createBlog(c.getAuthor());
|
Blog b = blogFactory.createBlog(c.getAuthor());
|
||||||
removeBlog(txn, b);
|
if (db.containsGroup(txn, b.getId())) removeBlog(txn, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -157,6 +157,8 @@ public class BlogManagerImplTest extends BriarTestCase {
|
|||||||
context.checking(new Expectations() {{
|
context.checking(new Expectations() {{
|
||||||
oneOf(blogFactory).createBlog(blog2.getAuthor());
|
oneOf(blogFactory).createBlog(blog2.getAuthor());
|
||||||
will(returnValue(blog2));
|
will(returnValue(blog2));
|
||||||
|
oneOf(db).containsGroup(txn, blog2.getId());
|
||||||
|
will(returnValue(true));
|
||||||
oneOf(identityManager).getLocalAuthor(txn);
|
oneOf(identityManager).getLocalAuthor(txn);
|
||||||
will(returnValue(blog1.getAuthor()));
|
will(returnValue(blog1.getAuthor()));
|
||||||
oneOf(db).removeGroup(txn, blog2.getGroup());
|
oneOf(db).removeGroup(txn, blog2.getGroup());
|
||||||
@@ -166,6 +168,25 @@ public class BlogManagerImplTest extends BriarTestCase {
|
|||||||
context.assertIsSatisfied();
|
context.assertIsSatisfied();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testRemovingContactAfterRemovingBlog() throws DbException {
|
||||||
|
final Transaction txn = new Transaction(null, false);
|
||||||
|
|
||||||
|
final ContactId contactId = new ContactId(0);
|
||||||
|
Contact contact = new Contact(contactId, blog2.getAuthor(),
|
||||||
|
blog1.getAuthor().getId(), true, true);
|
||||||
|
|
||||||
|
context.checking(new Expectations() {{
|
||||||
|
oneOf(blogFactory).createBlog(blog2.getAuthor());
|
||||||
|
will(returnValue(blog2));
|
||||||
|
oneOf(db).containsGroup(txn, blog2.getId());
|
||||||
|
will(returnValue(false));
|
||||||
|
}});
|
||||||
|
|
||||||
|
blogManager.removingContact(txn, contact);
|
||||||
|
context.assertIsSatisfied();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIncomingMessage() throws DbException, FormatException {
|
public void testIncomingMessage() throws DbException, FormatException {
|
||||||
final Transaction txn = new Transaction(null, false);
|
final Transaction txn = new Transaction(null, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user