Skip to content

Commit

Permalink
Merge pull request #10 from tnek/master
Browse files Browse the repository at this point in the history
Update bazel version, add test for teamID
  • Loading branch information
tnek authored Oct 15, 2021
2 parents 7ef66f1 + c992bf7 commit 1fc72bc
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ objc_library(
objc_library(
name = "MOLCodesignCheckerTestsLib",
srcs = ["Tests/MOLCodesignCheckerTest.m"],
data = glob(["Tests/Resources/*"]),
deps = [":MOLCodesignChecker"],
)

macos_unit_test(
name = "MOLCodesignCheckerTests",
minimum_os_version = "10.9",
resources = glob(["Tests/Resources/*"]),
deps = [":MOLCodesignCheckerTestsLib"],
)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "MOLCertificate",
remote = "https://github.com/google/macops-molcertificate.git",
tag = "v2.0",
tag = "v2.1",
)
git_repository(
name = "MOLCodesignChecker",
remote = "https://github.com/google/macops-molcodesignchecker.git",
tag = "v2.1",
tag = "v2.2",
)
```

Expand Down
16 changes: 14 additions & 2 deletions Tests/MOLCodesignCheckerTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,7 @@ - (void)testAllArchitectures {
NSError *error;
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString *path = [bundle pathForResource:@"cal-yikes-universal" ofType:@""];
MOLCodesignChecker *sut =
[[MOLCodesignChecker alloc] initWithBinaryPath:path error:&error];
MOLCodesignChecker *sut = [[MOLCodesignChecker alloc] initWithBinaryPath:path error:&error];
XCTAssertNotNil(sut.universalSigningInformation);
XCTAssertNil(sut.leafCertificate);
XCTAssertEqual(error.code, errSecCSSignatureInvalid);
Expand Down Expand Up @@ -177,4 +176,17 @@ - (void)testAllArchitectures {
XCTAssertNil(error);
}

- (void)testTeamID {
NSError *error;
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
NSString *path = [bundle pathForResource:@"signed-with-teamid" ofType:@""];

MOLCodesignChecker *sut = [[MOLCodesignChecker alloc] initWithBinaryPath:path error:&error];
XCTAssertNotNil(sut.signingInformation);
XCTAssertNil(error);

NSString *gotTeamID = [sut.signingInformation valueForKey:@"teamid"];
XCTAssertEqualObjects(@"EQHXZ8M8AV", gotTeamID);
}

@end
Binary file added Tests/Resources/signed-with-teamid
Binary file not shown.
5 changes: 2 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "build_bazel_rules_apple",
remote = "https://github.com/bazelbuild/rules_apple.git",
tag = "0.13.0",
tag = "0.31.3",
)

load(
Expand All @@ -16,6 +16,5 @@ apple_rules_dependencies()
git_repository(
name = "MOLCertificate",
remote = "https://github.com/google/macops-molcertificate.git",
tag = "v2.0",
tag = "v2.1",
)

0 comments on commit 1fc72bc

Please sign in to comment.