pEpObjCTests/PEPSessionTest.m
changeset 418 9011c5049047
parent 416 5a37145e3eca
child 419 87b95754eed3
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Fri Feb 02 13:13:59 2018 +0100
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Fri Feb 02 13:27:36 2018 +0100
     1.3 @@ -653,6 +653,49 @@
     1.4      XCTAssertNotEqualObjects(encMessage.shortMessage, @"p≡p", @"Subject should not be encrypted");
     1.5  }
     1.6  
     1.7 +- (void)testStringToRating
     1.8 +{
     1.9 +    PEPSession *session = [PEPSession new];
    1.10 +    XCTAssertEqual([session ratingFromString:@"cannot_decrypt"], PEP_rating_cannot_decrypt);
    1.11 +    XCTAssertEqual([session ratingFromString:@"have_no_key"], PEP_rating_have_no_key);
    1.12 +    XCTAssertEqual([session ratingFromString:@"unencrypted"], PEP_rating_unencrypted);
    1.13 +    XCTAssertEqual([session ratingFromString:@"unencrypted_for_some"],
    1.14 +                   PEP_rating_unencrypted_for_some);
    1.15 +    XCTAssertEqual([session ratingFromString:@"unreliable"], PEP_rating_unreliable);
    1.16 +    XCTAssertEqual([session ratingFromString:@"reliable"], PEP_rating_reliable);
    1.17 +    XCTAssertEqual([session ratingFromString:@"trusted"], PEP_rating_trusted);
    1.18 +    XCTAssertEqual([session ratingFromString:@"trusted_and_anonymized"],
    1.19 +                   PEP_rating_trusted_and_anonymized);
    1.20 +    XCTAssertEqual([session ratingFromString:@"fully_anonymous"], PEP_rating_fully_anonymous);
    1.21 +    XCTAssertEqual([session ratingFromString:@"mistrust"], PEP_rating_mistrust);
    1.22 +    XCTAssertEqual([session ratingFromString:@"b0rken"], PEP_rating_b0rken);
    1.23 +    XCTAssertEqual([session ratingFromString:@"under_attack"], PEP_rating_under_attack);
    1.24 +    XCTAssertEqual([session ratingFromString:@"undefined"], PEP_rating_undefined);
    1.25 +    XCTAssertEqual([session ratingFromString:@"does not exist111"], PEP_rating_undefined);
    1.26 +}
    1.27 +
    1.28 +- (void)testRatingToString
    1.29 +{
    1.30 +    PEPSession *session = [PEPSession new];
    1.31 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_cannot_decrypt], @"cannot_decrypt");
    1.32 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_have_no_key], @"have_no_key");
    1.33 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_unencrypted], @"unencrypted");
    1.34 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_unencrypted_for_some],
    1.35 +                          @"unencrypted_for_some");
    1.36 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_unreliable], @"unreliable");
    1.37 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_reliable], @"reliable");
    1.38 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_trusted], @"trusted");
    1.39 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_trusted_and_anonymized],
    1.40 +                          @"trusted_and_anonymized");
    1.41 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_fully_anonymous],
    1.42 +                          @"fully_anonymous");
    1.43 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_mistrust], @"mistrust");
    1.44 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_b0rken], @"b0rken");
    1.45 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_under_attack], @"under_attack");
    1.46 +    XCTAssertEqualObjects([session stringFromRating:PEP_rating_undefined], @"undefined");
    1.47 +    XCTAssertEqualObjects([session stringFromRating:500], @"undefined");
    1.48 +}
    1.49 +
    1.50  #pragma mark - Helpers
    1.51  
    1.52  - (PEPMessage *)mailWrittenToMySelf