From fe350147f92beec45632ad26106c2c0bf33e9fc9 Mon Sep 17 00:00:00 2001 From: Julien WITTOUCK Date: Mon, 20 Jan 2020 18:20:12 +0100 Subject: [PATCH] :white_check_mark: : add Github import IT --- .../controller/GithubRegistryControllerIT.kt | 135 ++++ .../rest/github/selmak-public-repos.json | 305 +++++++++ ...raform-docker-mongo-content-variables.json | 18 + .../github/selmak-terraform-docker-mongo.json | 106 ++++ .../resources/rest/hashicorp/releases.html | 577 ++++++++++++++++++ 5 files changed, 1141 insertions(+) create mode 100644 src/test/java/io/codeka/gaia/registries/controller/GithubRegistryControllerIT.kt create mode 100644 src/test/resources/rest/github/selmak-public-repos.json create mode 100644 src/test/resources/rest/github/selmak-terraform-docker-mongo-content-variables.json create mode 100644 src/test/resources/rest/github/selmak-terraform-docker-mongo.json create mode 100644 src/test/resources/rest/hashicorp/releases.html diff --git a/src/test/java/io/codeka/gaia/registries/controller/GithubRegistryControllerIT.kt b/src/test/java/io/codeka/gaia/registries/controller/GithubRegistryControllerIT.kt new file mode 100644 index 000000000..7c56aa5d0 --- /dev/null +++ b/src/test/java/io/codeka/gaia/registries/controller/GithubRegistryControllerIT.kt @@ -0,0 +1,135 @@ +package io.codeka.gaia.registries.controller + +import com.fasterxml.jackson.databind.ObjectMapper +import io.codeka.gaia.modules.bo.Variable +import io.codeka.gaia.modules.repository.TerraformModuleRepository +import io.codeka.gaia.registries.RegistryDetails +import io.codeka.gaia.registries.RegistryType +import io.codeka.gaia.registries.github.GithubRepository +import io.codeka.gaia.teams.OAuth2User +import io.codeka.gaia.teams.User +import io.codeka.gaia.test.MongoContainer +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test +import org.springframework.beans.factory.annotation.Autowired +import org.springframework.boot.test.autoconfigure.web.client.AutoConfigureWebClient +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc +import org.springframework.boot.test.context.SpringBootTest +import org.springframework.core.io.ClassPathResource +import org.springframework.http.MediaType +import org.springframework.test.annotation.DirtiesContext +import org.springframework.test.web.client.MockRestServiceServer +import org.springframework.test.web.client.match.MockRestRequestMatchers +import org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo +import org.springframework.test.web.client.response.MockRestResponseCreators +import org.springframework.test.web.servlet.MockMvc +import org.springframework.web.client.RestTemplate +import org.testcontainers.junit.jupiter.Container +import org.testcontainers.junit.jupiter.Testcontainers +import java.util.* + +@SpringBootTest +@DirtiesContext +@Testcontainers +@AutoConfigureMockMvc +@AutoConfigureWebClient +class GithubRegistryControllerIT{ + + @Autowired + private lateinit var mockMvc: MockMvc + + @Autowired + private lateinit var objectMapper: ObjectMapper + + @Autowired + private lateinit var restTemplate: RestTemplate + + @Autowired + private lateinit var terraformModuleRepository: TerraformModuleRepository + + companion object { + @Container + private val mongoContainer = MongoContainer() + } + + @Autowired + private lateinit var githubRegistryController: GithubRegistryController + + @Test + fun validateTestConfiguration(){ + assertThat(mockMvc).isNotNull + assertThat(objectMapper).isNotNull + assertThat(githubRegistryController).isNotNull + assertThat(restTemplate).isNotNull + } + + @Test + fun testGetRepositories(){ + // given + val server = MockRestServiceServer.bindTo(restTemplate).build() + server.expect(requestTo("https://api.github.com/user/repos?visibility=public")) + .andExpect(MockRestRequestMatchers.header("Authorization", "Bearer Tok'ra")) + .andRespond(MockRestResponseCreators.withSuccess(ClassPathResource("/rest/github/selmak-public-repos.json"), MediaType.APPLICATION_JSON)) + + val selmak = User("Selmak", null) + selmak.oAuth2User = OAuth2User("GITHUB", "Tok'ra", null) + + // when + val repoList = githubRegistryController.getRepositories(selmak) + + // then + assertThat(repoList).hasSize(3) + assertThat(repoList).containsExactly( + GithubRepository("selmak/terraform-aws-eks", "https://github.com/selmak/terraform-aws-eks"), + GithubRepository("selmak/terraform-docker-mongo", "https://github.com/selmak/terraform-docker-mongo"), + GithubRepository("selmak/terraform-provider-aws-examples", "https://github.com/selmak/terraform-provider-aws-examples") + ) + + server.verify() + } + + @Test + fun testImportRepository(){ + // given + val server = MockRestServiceServer.bindTo(restTemplate).build() + + server.expect(requestTo("https://api.github.com/repos/selmak/terraform-docker-mongo")) + .andExpect(MockRestRequestMatchers.header("Authorization", "Bearer Tok'ra")) + .andRespond(MockRestResponseCreators.withSuccess(ClassPathResource("/rest/github/selmak-terraform-docker-mongo.json"), MediaType.APPLICATION_JSON)) + + server.expect(requestTo("https://releases.hashicorp.com/terraform/")) + .andRespond(MockRestResponseCreators.withSuccess(ClassPathResource("/rest/hashicorp/releases.html"), MediaType.TEXT_HTML)) + + server.expect(requestTo("https://api.github.com/repos/selmak/terraform-docker-mongo/contents/variables.tf?ref=master")) + .andExpect(MockRestRequestMatchers.header("Authorization", "Bearer Tok'ra")) + .andRespond(MockRestResponseCreators.withSuccess(ClassPathResource("/rest/github/selmak-terraform-docker-mongo-content-variables.json"), MediaType.APPLICATION_JSON)) + + val selmak = User("Selmak", null) + selmak.oAuth2User = OAuth2User("GITHUB", "Tok'ra", null) + + // when + val importedModule = githubRegistryController.importRepository("selmak", "terraform-docker-mongo", selmak) + + // then + assertThat(importedModule).isNotNull + + assertThat(importedModule.id).isNotBlank() + assertThat(importedModule.name).isEqualTo("selmak/terraform-docker-mongo") + assertThat(importedModule.createdBy).isEqualTo(selmak) + + assertThat(importedModule.gitRepositoryUrl).isEqualTo("https://github.com/selmak/terraform-docker-mongo") + assertThat(importedModule.registryDetails).isEqualTo(RegistryDetails(RegistryType.GITHUB, "selmak/terraform-docker-mongo")) + assertThat(importedModule.cliVersion).isEqualTo("0.12.19") + + assertThat(importedModule.variables).containsExactly( + Variable("mongo_container_name", "string", "name of the container"), + Variable("mongo_exposed_port", "string", "exposed port of the mongo container", "27017") + ) + + assertThat(terraformModuleRepository.findById(importedModule.id)) + .isNotEmpty + .hasValueSatisfying { it.name == "selmak/terraform-docker-mongo" } + + server.verify() + } +} \ No newline at end of file diff --git a/src/test/resources/rest/github/selmak-public-repos.json b/src/test/resources/rest/github/selmak-public-repos.json new file mode 100644 index 000000000..dbc4dafc1 --- /dev/null +++ b/src/test/resources/rest/github/selmak-public-repos.json @@ -0,0 +1,305 @@ +[ + { + "id": 219807876, + "node_id": "MDEwOlJlcG9zaXRvcnkyMTk4MDc4NzY=", + "name": "terraform-aws-eks", + "full_name": "selmak/terraform-aws-eks", + "private": false, + "owner": { + "login": "selmak", + "id": 7531844, + "node_id": "MDQ6VXNlcjc1MzE4NDQ=", + "avatar_url": "https://avatars2.githubusercontent.com/u/7531844?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/selmak", + "html_url": "https://github.com/selmak", + "followers_url": "https://api.github.com/users/selmak/followers", + "following_url": "https://api.github.com/users/selmak/following{/other_user}", + "gists_url": "https://api.github.com/users/selmak/gists{/gist_id}", + "starred_url": "https://api.github.com/users/selmak/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/selmak/subscriptions", + "organizations_url": "https://api.github.com/users/selmak/orgs", + "repos_url": "https://api.github.com/users/selmak/repos", + "events_url": "https://api.github.com/users/selmak/events{/privacy}", + "received_events_url": "https://api.github.com/users/selmak/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/selmak/terraform-aws-eks", + "description": "A Terraform module to create an Elastic Kubernetes (EKS) cluster and associated worker instances on AWS.", + "fork": true, + "url": "https://api.github.com/repos/selmak/terraform-aws-eks", + "forks_url": "https://api.github.com/repos/selmak/terraform-aws-eks/forks", + "keys_url": "https://api.github.com/repos/selmak/terraform-aws-eks/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/selmak/terraform-aws-eks/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/selmak/terraform-aws-eks/teams", + "hooks_url": "https://api.github.com/repos/selmak/terraform-aws-eks/hooks", + "issue_events_url": "https://api.github.com/repos/selmak/terraform-aws-eks/issues/events{/number}", + "events_url": "https://api.github.com/repos/selmak/terraform-aws-eks/events", + "assignees_url": "https://api.github.com/repos/selmak/terraform-aws-eks/assignees{/user}", + "branches_url": "https://api.github.com/repos/selmak/terraform-aws-eks/branches{/branch}", + "tags_url": "https://api.github.com/repos/selmak/terraform-aws-eks/tags", + "blobs_url": "https://api.github.com/repos/selmak/terraform-aws-eks/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/selmak/terraform-aws-eks/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/selmak/terraform-aws-eks/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/selmak/terraform-aws-eks/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/selmak/terraform-aws-eks/statuses/{sha}", + "languages_url": "https://api.github.com/repos/selmak/terraform-aws-eks/languages", + "stargazers_url": "https://api.github.com/repos/selmak/terraform-aws-eks/stargazers", + "contributors_url": "https://api.github.com/repos/selmak/terraform-aws-eks/contributors", + "subscribers_url": "https://api.github.com/repos/selmak/terraform-aws-eks/subscribers", + "subscription_url": "https://api.github.com/repos/selmak/terraform-aws-eks/subscription", + "commits_url": "https://api.github.com/repos/selmak/terraform-aws-eks/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/selmak/terraform-aws-eks/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/selmak/terraform-aws-eks/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/selmak/terraform-aws-eks/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/selmak/terraform-aws-eks/contents/{+path}", + "compare_url": "https://api.github.com/repos/selmak/terraform-aws-eks/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/selmak/terraform-aws-eks/merges", + "archive_url": "https://api.github.com/repos/selmak/terraform-aws-eks/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/selmak/terraform-aws-eks/downloads", + "issues_url": "https://api.github.com/repos/selmak/terraform-aws-eks/issues{/number}", + "pulls_url": "https://api.github.com/repos/selmak/terraform-aws-eks/pulls{/number}", + "milestones_url": "https://api.github.com/repos/selmak/terraform-aws-eks/milestones{/number}", + "notifications_url": "https://api.github.com/repos/selmak/terraform-aws-eks/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/selmak/terraform-aws-eks/labels{/name}", + "releases_url": "https://api.github.com/repos/selmak/terraform-aws-eks/releases{/id}", + "deployments_url": "https://api.github.com/repos/selmak/terraform-aws-eks/deployments", + "created_at": "2019-11-05T17:51:27Z", + "updated_at": "2019-11-05T17:51:30Z", + "pushed_at": "2019-11-05T16:00:53Z", + "git_url": "git://github.com/selmak/terraform-aws-eks.git", + "ssh_url": "git@github.com:selmak/terraform-aws-eks.git", + "clone_url": "https://github.com/selmak/terraform-aws-eks.git", + "svn_url": "https://github.com/selmak/terraform-aws-eks", + "homepage": "https://registry.terraform.io/modules/terraform-aws-modules/eks/aws", + "size": 580, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": { + "key": "mit", + "name": "MIT License", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit", + "node_id": "MDc6TGljZW5zZTEz" + }, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": true, + "push": true, + "pull": true + } + }, + { + "id": 187221981, + "node_id": "MDEwOlJlcG9zaXRvcnkxODcyMjE5ODE=", + "name": "terraform-docker-mongo", + "full_name": "selmak/terraform-docker-mongo", + "private": false, + "owner": { + "login": "selmak", + "id": 7531844, + "node_id": "MDQ6VXNlcjc1MzE4NDQ=", + "avatar_url": "https://avatars2.githubusercontent.com/u/7531844?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/selmak", + "html_url": "https://github.com/selmak", + "followers_url": "https://api.github.com/users/selmak/followers", + "following_url": "https://api.github.com/users/selmak/following{/other_user}", + "gists_url": "https://api.github.com/users/selmak/gists{/gist_id}", + "starred_url": "https://api.github.com/users/selmak/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/selmak/subscriptions", + "organizations_url": "https://api.github.com/users/selmak/orgs", + "repos_url": "https://api.github.com/users/selmak/repos", + "events_url": "https://api.github.com/users/selmak/events{/privacy}", + "received_events_url": "https://api.github.com/users/selmak/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/selmak/terraform-docker-mongo", + "description": "A sample terraform 🌍 module for running a mongodb 🍃 database inside a docker 🐳 container", + "fork": false, + "url": "https://api.github.com/repos/selmak/terraform-docker-mongo", + "forks_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/forks", + "keys_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/teams", + "hooks_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/hooks", + "issue_events_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/issues/events{/number}", + "events_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/events", + "assignees_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/assignees{/user}", + "branches_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/branches{/branch}", + "tags_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/tags", + "blobs_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/languages", + "stargazers_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/stargazers", + "contributors_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/contributors", + "subscribers_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/subscribers", + "subscription_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/subscription", + "commits_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/contents/{+path}", + "compare_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/merges", + "archive_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/downloads", + "issues_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/issues{/number}", + "pulls_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/labels{/name}", + "releases_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/releases{/id}", + "deployments_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/deployments", + "created_at": "2019-05-17T13:33:19Z", + "updated_at": "2019-06-18T14:54:34Z", + "pushed_at": "2019-06-18T14:54:32Z", + "git_url": "git://github.com/selmak/terraform-docker-mongo.git", + "ssh_url": "git@github.com:selmak/terraform-docker-mongo.git", + "clone_url": "https://github.com/selmak/terraform-docker-mongo.git", + "svn_url": "https://github.com/selmak/terraform-docker-mongo", + "homepage": null, + "size": 4, + "stargazers_count": 0, + "watchers_count": 0, + "language": "HCL", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 1, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 1, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": true, + "push": true, + "pull": true + } + }, + { + "id": 183646661, + "node_id": "MDEwOlJlcG9zaXRvcnkxODM2NDY2NjE=", + "name": "terraform-provider-aws-examples", + "full_name": "selmak/terraform-provider-aws-examples", + "private": false, + "owner": { + "login": "selmak", + "id": 7531844, + "node_id": "MDQ6VXNlcjc1MzE4NDQ=", + "avatar_url": "https://avatars2.githubusercontent.com/u/7531844?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/selmak", + "html_url": "https://github.com/selmak", + "followers_url": "https://api.github.com/users/selmak/followers", + "following_url": "https://api.github.com/users/selmak/following{/other_user}", + "gists_url": "https://api.github.com/users/selmak/gists{/gist_id}", + "starred_url": "https://api.github.com/users/selmak/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/selmak/subscriptions", + "organizations_url": "https://api.github.com/users/selmak/orgs", + "repos_url": "https://api.github.com/users/selmak/repos", + "events_url": "https://api.github.com/users/selmak/events{/privacy}", + "received_events_url": "https://api.github.com/users/selmak/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/selmak/terraform-provider-aws-examples", + "description": "Terraform AWS provider examples", + "fork": false, + "url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples", + "forks_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/forks", + "keys_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/teams", + "hooks_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/hooks", + "issue_events_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/issues/events{/number}", + "events_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/events", + "assignees_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/assignees{/user}", + "branches_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/branches{/branch}", + "tags_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/tags", + "blobs_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/statuses/{sha}", + "languages_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/languages", + "stargazers_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/stargazers", + "contributors_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/contributors", + "subscribers_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/subscribers", + "subscription_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/subscription", + "commits_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/contents/{+path}", + "compare_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/merges", + "archive_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/downloads", + "issues_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/issues{/number}", + "pulls_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/pulls{/number}", + "milestones_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/milestones{/number}", + "notifications_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/labels{/name}", + "releases_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/releases{/id}", + "deployments_url": "https://api.github.com/repos/selmak/terraform-provider-aws-examples/deployments", + "created_at": "2019-04-26T14:51:30Z", + "updated_at": "2019-04-26T14:54:23Z", + "pushed_at": "2019-04-26T14:54:21Z", + "git_url": "git://github.com/selmak/terraform-provider-aws-examples.git", + "ssh_url": "git@github.com:selmak/terraform-provider-aws-examples.git", + "clone_url": "https://github.com/selmak/terraform-provider-aws-examples.git", + "svn_url": "https://github.com/selmak/terraform-provider-aws-examples", + "homepage": null, + "size": 33, + "stargazers_count": 0, + "watchers_count": 0, + "language": "HCL", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": true, + "push": true, + "pull": true + } + } +] \ No newline at end of file diff --git a/src/test/resources/rest/github/selmak-terraform-docker-mongo-content-variables.json b/src/test/resources/rest/github/selmak-terraform-docker-mongo-content-variables.json new file mode 100644 index 000000000..edfe5d702 --- /dev/null +++ b/src/test/resources/rest/github/selmak-terraform-docker-mongo-content-variables.json @@ -0,0 +1,18 @@ +{ + "name": "variables.tf", + "path": "variables.tf", + "sha": "533f859b7c038f7d3003ca3f693abc34370bcf67", + "size": 242, + "url": "https://api.github.com/repos/juwit/terraform-docker-mongo/contents/variables.tf?ref=master", + "html_url": "https://github.com/juwit/terraform-docker-mongo/blob/master/variables.tf", + "git_url": "https://api.github.com/repos/juwit/terraform-docker-mongo/git/blobs/533f859b7c038f7d3003ca3f693abc34370bcf67", + "download_url": "https://raw.githubusercontent.com/juwit/terraform-docker-mongo/master/variables.tf", + "type": "file", + "content": "dmFyaWFibGUgIm1vbmdvX2NvbnRhaW5lcl9uYW1lIiB7CiAgICB0eXBlID0g\nInN0cmluZyIKICAgIGRlc2NyaXB0aW9uID0gIm5hbWUgb2YgdGhlIGNvbnRh\naW5lciIKfQoKdmFyaWFibGUgIm1vbmdvX2V4cG9zZWRfcG9ydCIgewogICAg\ndHlwZSAgICAgICAgPSAic3RyaW5nIgogICAgZGVzY3JpcHRpb24gPSAiZXhw\nb3NlZCBwb3J0IG9mIHRoZSBtb25nbyBjb250YWluZXIiCiAgICBkZWZhdWx0\nICAgICA9ICIyNzAxNyIKfQo=\n", + "encoding": "base64", + "_links": { + "self": "https://api.github.com/repos/juwit/terraform-docker-mongo/contents/variables.tf?ref=master", + "git": "https://api.github.com/repos/juwit/terraform-docker-mongo/git/blobs/533f859b7c038f7d3003ca3f693abc34370bcf67", + "html": "https://github.com/juwit/terraform-docker-mongo/blob/master/variables.tf" + } +} \ No newline at end of file diff --git a/src/test/resources/rest/github/selmak-terraform-docker-mongo.json b/src/test/resources/rest/github/selmak-terraform-docker-mongo.json new file mode 100644 index 000000000..c27549b9c --- /dev/null +++ b/src/test/resources/rest/github/selmak-terraform-docker-mongo.json @@ -0,0 +1,106 @@ +{ + "id": 187221981, + "node_id": "MDEwOlJlcG9zaXRvcnkxODcyMjE5ODE=", + "name": "terraform-docker-mongo", + "full_name": "selmak/terraform-docker-mongo", + "private": false, + "owner": { + "login": "selmak", + "id": 7531844, + "node_id": "MDQ6VXNlcjc1MzE4NDQ=", + "avatar_url": "https://avatars2.githubusercontent.com/u/7531844?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/selmak", + "html_url": "https://github.com/selmak", + "followers_url": "https://api.github.com/users/selmak/followers", + "following_url": "https://api.github.com/users/selmak/following{/other_user}", + "gists_url": "https://api.github.com/users/selmak/gists{/gist_id}", + "starred_url": "https://api.github.com/users/selmak/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/selmak/subscriptions", + "organizations_url": "https://api.github.com/users/selmak/orgs", + "repos_url": "https://api.github.com/users/selmak/repos", + "events_url": "https://api.github.com/users/selmak/events{/privacy}", + "received_events_url": "https://api.github.com/users/selmak/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/selmak/terraform-docker-mongo", + "description": "A sample terraform 🌍 module for running a mongodb 🍃 database inside a docker 🐳 container", + "fork": false, + "url": "https://api.github.com/repos/selmak/terraform-docker-mongo", + "forks_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/forks", + "keys_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/teams", + "hooks_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/hooks", + "issue_events_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/issues/events{/number}", + "events_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/events", + "assignees_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/assignees{/user}", + "branches_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/branches{/branch}", + "tags_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/tags", + "blobs_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/statuses/{sha}", + "languages_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/languages", + "stargazers_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/stargazers", + "contributors_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/contributors", + "subscribers_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/subscribers", + "subscription_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/subscription", + "commits_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/contents/{+path}", + "compare_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/merges", + "archive_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/downloads", + "issues_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/issues{/number}", + "pulls_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/pulls{/number}", + "milestones_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/milestones{/number}", + "notifications_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/labels{/name}", + "releases_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/releases{/id}", + "deployments_url": "https://api.github.com/repos/selmak/terraform-docker-mongo/deployments", + "created_at": "2019-05-17T13:33:19Z", + "updated_at": "2019-06-18T14:54:34Z", + "pushed_at": "2019-06-18T14:54:32Z", + "git_url": "git://github.com/selmak/terraform-docker-mongo.git", + "ssh_url": "git@github.com:selmak/terraform-docker-mongo.git", + "clone_url": "https://github.com/selmak/terraform-docker-mongo.git", + "svn_url": "https://github.com/selmak/terraform-docker-mongo", + "homepage": null, + "size": 4, + "stargazers_count": 0, + "watchers_count": 0, + "language": "HCL", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 1, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 1, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": true, + "push": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "delete_branch_on_merge": false, + "network_count": 1, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/rest/hashicorp/releases.html b/src/test/resources/rest/hashicorp/releases.html new file mode 100644 index 000000000..8954d3c07 --- /dev/null +++ b/src/test/resources/rest/hashicorp/releases.html @@ -0,0 +1,577 @@ + + + + Terraform Versions | HashiCorp Releases + + + + + + + + + + + + + \ No newline at end of file