IOSAD-163 Make sure: No beacons for 2nd id IOSAD-163
authorDirk Zimmermann <dz@pep.security>
Wed, 08 Jan 2020 13:36:06 +0100
branchIOSAD-163
changeset 1384ac3d4231e448
parent 1383 d73588490e8a
child 1385 1ca64cfa12a2
IOSAD-163 Make sure: No beacons for 2nd id
pEpObjCTests/PEPSessionTest.m
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Wed Jan 08 13:36:06 2020 +0100
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Wed Jan 08 13:36:06 2020 +0100
     1.3 @@ -1302,8 +1302,9 @@
     1.4      XCTAssertEqual(self.sendMessageDelegate.messages.count, 0);
     1.5      XCTAssertNil(self.sendMessageDelegate.lastMessage);
     1.6  
     1.7 +    NSString *emailAddress1 = @"me-myself-and-i-1@pep-project.org";
     1.8      PEPIdentity *identMe1 = [[PEPIdentity alloc]
     1.9 -                             initWithAddress:@"me-myself-and-i-1@pep-project.org"
    1.10 +                             initWithAddress:emailAddress1
    1.11                               userID:@"me-myself-and-i-1"
    1.12                               userName:@"pEp Me"
    1.13                               isOwn:YES];
    1.14 @@ -1332,7 +1333,13 @@
    1.15  
    1.16      [NSThread sleepForTimeInterval:2];
    1.17  
    1.18 -    XCTAssertEqual(self.sendMessageDelegate.messages.count, 1);
    1.19 +    // Make sure all beacon messages are for the pEp sync enabled identity.
    1.20 +    for (PEPMessage *msg in self.sendMessageDelegate.messages) {
    1.21 +        XCTAssertEqualObjects(msg.from.address, emailAddress1);
    1.22 +        for (PEPIdentity *receiver in msg.to) {
    1.23 +            XCTAssertEqualObjects(receiver.address, emailAddress1);
    1.24 +        }
    1.25 +    }
    1.26  
    1.27      [self shutdownSync];
    1.28  }