Skip to content

Commit

Permalink
aws#907 Adds test for codebuild github source.
Browse files Browse the repository at this point in the history
  • Loading branch information
eaddingtonwhite committed Oct 12, 2018
1 parent ee1b38c commit 6530d86
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions packages/@aws-cdk/aws-codebuild/test/test.project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,42 @@ export = {
test.done();
},

'github auth test'(test: Test) {
// GIVEN
const stack = new cdk.Stack();

// WHEN
new codebuild.Project(stack, 'Project', {
source: new codebuild.GitHubSource({
cloneUrl: "https://github.com/testowner/testrepo",
oauthToken: new cdk.Secret("test_oauth_token")
})
});

// THEN
expect(stack).to(haveResource('AWS::CodeBuild::Project', {
Source: {
Type: "GITHUB",
Auth: {
Type: 'OAUTH',
Resource: 'test_oauth_token'
},
Location: 'https://github.com/testowner/testrepo'
}
}));

test.done();
},

'github enterprise auth test'(test: Test) {
// GIVEN
const stack = new cdk.Stack();

// WHEN
new codebuild.Project(stack, 'Project', {
source: new codebuild.GitHubEnterpriseSource({
cloneUrl: "https://mycompany.github.com",
oauthToken: new cdk.Secret("my_oauth_token")
cloneUrl: "https://github.testcompany.com/testowner/testrepo",
oauthToken: new cdk.Secret("test_oauth_token")
})
});

Expand All @@ -65,9 +92,9 @@ export = {
Type: "GITHUB_ENTERPRISE",
Auth: {
Type: 'OAUTH',
Resource: 'my_oauth_token'
Resource: 'test_oauth_token'
},
Location: 'https://mycompany.github.com'
Location: 'https://github.testcompany.com/testowner/testrepo'
}
}));

Expand Down

0 comments on commit 6530d86

Please sign in to comment.