Skip to content

Commit

Permalink
mock apis for git repo in test serverless function tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sanketpathak committed Aug 25, 2023
1 parent 63510ec commit 276a844
Show file tree
Hide file tree
Showing 24 changed files with 1,666 additions and 2 deletions.
Expand Up @@ -45,6 +45,11 @@ export const gitPage = {
statusCode: responses.devFileResources ? 200 : 404,
body: responses.devFileResources,
}).as('getDevfileResources');

cy.intercept('GET', `${apiBaseUrl}/contents//func.yaml`, {
statusCode: responses.funcJson ? 200 : 404,
body: responses.funcJson,
}).as('getFuncJson');
}

cy.get(gitPO.gitRepoUrl).clear().type(gitUrl);
Expand Down
@@ -0,0 +1,114 @@
[
{
"name": ".gitignore",
"path": ".gitignore",
"sha": "3abd5fdff11e295a0d72346ac99fe7034da1c6cb",
"size": 126,
"url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/.gitignore?ref=master",
"html_url": "https://github.com/vikram-raj/hello-func-node-env/blob/master/.gitignore",
"git_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/3abd5fdff11e295a0d72346ac99fe7034da1c6cb",
"download_url": "https://raw.githubusercontent.com/vikram-raj/hello-func-node-env/master/.gitignore",
"type": "file",
"_links": {
"self": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/.gitignore?ref=master",
"git": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/3abd5fdff11e295a0d72346ac99fe7034da1c6cb",
"html": "https://github.com/vikram-raj/hello-func-node-env/blob/master/.gitignore"
}
},
{
"name": "README.md",
"path": "README.md",
"sha": "3ecedd17b45af0a59d4a52dd648eda8ba090047a",
"size": 2096,
"url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/README.md?ref=master",
"html_url": "https://github.com/vikram-raj/hello-func-node-env/blob/master/README.md",
"git_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/3ecedd17b45af0a59d4a52dd648eda8ba090047a",
"download_url": "https://raw.githubusercontent.com/vikram-raj/hello-func-node-env/master/README.md",
"type": "file",
"_links": {
"self": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/README.md?ref=master",
"git": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/3ecedd17b45af0a59d4a52dd648eda8ba090047a",
"html": "https://github.com/vikram-raj/hello-func-node-env/blob/master/README.md"
}
},
{
"name": "func.yaml",
"path": "func.yaml",
"sha": "0ee31c9ad466045e40efa70433806dd40f1ca3c7",
"size": 721,
"url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/func.yaml?ref=master",
"html_url": "https://github.com/vikram-raj/hello-func-node-env/blob/master/func.yaml",
"git_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/0ee31c9ad466045e40efa70433806dd40f1ca3c7",
"download_url": "https://raw.githubusercontent.com/vikram-raj/hello-func-node-env/master/func.yaml",
"type": "file",
"_links": {
"self": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/func.yaml?ref=master",
"git": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/0ee31c9ad466045e40efa70433806dd40f1ca3c7",
"html": "https://github.com/vikram-raj/hello-func-node-env/blob/master/func.yaml"
}
},
{
"name": "index.js",
"path": "index.js",
"sha": "04c81441d0b3e3e39bee13343c4058956f4ee0e4",
"size": 1463,
"url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/index.js?ref=master",
"html_url": "https://github.com/vikram-raj/hello-func-node-env/blob/master/index.js",
"git_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/04c81441d0b3e3e39bee13343c4058956f4ee0e4",
"download_url": "https://raw.githubusercontent.com/vikram-raj/hello-func-node-env/master/index.js",
"type": "file",
"_links": {
"self": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/index.js?ref=master",
"git": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/04c81441d0b3e3e39bee13343c4058956f4ee0e4",
"html": "https://github.com/vikram-raj/hello-func-node-env/blob/master/index.js"
}
},
{
"name": "package-lock.json",
"path": "package-lock.json",
"sha": "14391b4480f8919aa6cedfe7e92585eb55259d8a",
"size": 151831,
"url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/package-lock.json?ref=master",
"html_url": "https://github.com/vikram-raj/hello-func-node-env/blob/master/package-lock.json",
"git_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/14391b4480f8919aa6cedfe7e92585eb55259d8a",
"download_url": "https://raw.githubusercontent.com/vikram-raj/hello-func-node-env/master/package-lock.json",
"type": "file",
"_links": {
"self": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/package-lock.json?ref=master",
"git": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/14391b4480f8919aa6cedfe7e92585eb55259d8a",
"html": "https://github.com/vikram-raj/hello-func-node-env/blob/master/package-lock.json"
}
},
{
"name": "package.json",
"path": "package.json",
"sha": "2806b7a4ce0a7caf6f1e3d9c0a833c81db97f7eb",
"size": 565,
"url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/package.json?ref=master",
"html_url": "https://github.com/vikram-raj/hello-func-node-env/blob/master/package.json",
"git_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/2806b7a4ce0a7caf6f1e3d9c0a833c81db97f7eb",
"download_url": "https://raw.githubusercontent.com/vikram-raj/hello-func-node-env/master/package.json",
"type": "file",
"_links": {
"self": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/package.json?ref=master",
"git": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/2806b7a4ce0a7caf6f1e3d9c0a833c81db97f7eb",
"html": "https://github.com/vikram-raj/hello-func-node-env/blob/master/package.json"
}
},
{
"name": "test",
"path": "test",
"sha": "9cea2aab5cb7d30f925060499367172b566d0842",
"size": 0,
"url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/test?ref=master",
"html_url": "https://github.com/vikram-raj/hello-func-node-env/tree/master/test",
"git_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/trees/9cea2aab5cb7d30f925060499367172b566d0842",
"download_url": null,
"type": "dir",
"_links": {
"self": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/test?ref=master",
"git": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/trees/9cea2aab5cb7d30f925060499367172b566d0842",
"html": "https://github.com/vikram-raj/hello-func-node-env/tree/master/test"
}
}
]
@@ -0,0 +1,18 @@
{
"name": "func.yaml",
"path": "func.yaml",
"sha": "0ee31c9ad466045e40efa70433806dd40f1ca3c7",
"size": 721,
"url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/func.yaml?ref=master",
"html_url": "https://github.com/vikram-raj/hello-func-node-env/blob/master/func.yaml",
"git_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/0ee31c9ad466045e40efa70433806dd40f1ca3c7",
"download_url": "https://raw.githubusercontent.com/vikram-raj/hello-func-node-env/master/func.yaml",
"type": "file",
"content": "c3BlY1ZlcnNpb246IDAuMzQuMApuYW1lOiBoZWxsby1mdW5jLW5vZGUtZW52\nCnJ1bnRpbWU6IG5vZGUKcmVnaXN0cnk6IHF1YXkuaW8vdmlyYWpfMQppbWFn\nZTogaW1hZ2UtcmVnaXN0cnkub3BlbnNoaWZ0LWltYWdlLXJlZ2lzdHJ5LnN2\nYzo1MDAwL2RlZmF1bHQvaGVsbG8tZnVuYy1ub2RlLWVudjpsYXRlc3QKaW1h\nZ2VEaWdlc3Q6IHNoYTI1NjoyZjNmMzY2ODM3NDllZDM0YWNiNzVjNjYxMjhl\nYmM3MmVjNmYxZWVlN2RjMTUwNjAyOTMxMTEyMzkzZWI3OGE5CmNyZWF0ZWQ6\nIDIwMjItMTItMjdUMDc6NTQ6NDguMzU2NTY5MjY1KzA1OjMwCmludm9jYXRp\nb246CiAgZm9ybWF0OiBodHRwCmJ1aWxkOgogIGJ1aWxkcGFja3M6IFtdCiAg\nYnVpbGRlcjogczJpCiAgYnVpbGRFbnZzOgogIC0gbmFtZTogYnVpbGRFbnYK\nICAgIHZhbHVlOiBidWlsZEVudlZhbAogIC0gbmFtZTogYnVpbGRFbnYxCiAg\nICB2YWx1ZTogYnVpbGRFbnZWYWwxCnJ1bjoKICB2b2x1bWVzOiBbXQogIGVu\ndnM6CiAgLSBuYW1lOiBoZWxsbwogICAgdmFsdWU6IHdvcmxkCiAgLSBuYW1l\nOiBlbnYKICAgIHZhbHVlOiBlbnZWYWx1ZQpkZXBsb3k6CiAgbmFtZXNwYWNl\nOiB2aXJhagogIGFubm90YXRpb25zOiB7fQogIG9wdGlvbnM6IHt9CiAgbGFi\nZWxzOiBbXQogIGhlYWx0aEVuZHBvaW50czoKICAgIGxpdmVuZXNzOiAvaGVh\nbHRoL2xpdmVuZXNzCiAgICByZWFkaW5lc3M6IC9oZWFsdGgvcmVhZGluZXNz\nCg==\n",
"encoding": "base64",
"_links": {
"self": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/func.yaml?ref=master",
"git": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/0ee31c9ad466045e40efa70433806dd40f1ca3c7",
"html": "https://github.com/vikram-raj/hello-func-node-env/blob/master/func.yaml"
}
}
@@ -0,0 +1,18 @@
{
"name": "package.json",
"path": "package.json",
"sha": "2806b7a4ce0a7caf6f1e3d9c0a833c81db97f7eb",
"size": 565,
"url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/package.json?ref=master",
"html_url": "https://github.com/vikram-raj/hello-func-node-env/blob/master/package.json",
"git_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/2806b7a4ce0a7caf6f1e3d9c0a833c81db97f7eb",
"download_url": "https://raw.githubusercontent.com/vikram-raj/hello-func-node-env/master/package.json",
"type": "file",
"content": "ewogICJuYW1lIjogImh0dHAtaGFuZGxlciIsCiAgInZlcnNpb24iOiAiMC4x\nLjAiLAogICJkZXNjcmlwdGlvbiI6ICJBIGZ1bmN0aW9uIHdoaWNoIHJlc3Bv\nbmRzIHRvIEhUVFAgcmVxdWVzdHMiLAogICJtYWluIjogImluZGV4LmpzIiwK\nICAic2NyaXB0cyI6IHsKICAgICJ0ZXN0IjogIm5vZGUgdGVzdC91bml0Lmpz\nICYmIG5vZGUgdGVzdC9pbnRlZ3JhdGlvbi5qcyIsCiAgICAic3RhcnQiOiAi\nZmFhcy1qcy1ydW50aW1lIC4vaW5kZXguanMiLAogICAgImRlYnVnIjogIm5v\nZGVtb24gLS1pbnNwZWN0IC4vbm9kZV9tb2R1bGVzL2ZhYXMtanMtcnVudGlt\nZS9iaW4vY2xpLmpzIC4vaW5kZXguanMiCiAgfSwKICAia2V5d29yZHMiOiBb\nXSwKICAiYXV0aG9yIjogIiIsCiAgImxpY2Vuc2UiOiAiQXBhY2hlLTIuMCIs\nCiAgImRlcGVuZGVuY2llcyI6IHsKICAgICJmYWFzLWpzLXJ1bnRpbWUiOiAi\nXjAuOS4wIgogIH0sCiAgImRldkRlcGVuZGVuY2llcyI6IHsKICAgICJub2Rl\nbW9uIjogIl4yLjAuNCIsCiAgICAic3VwZXJ0ZXN0IjogIl40LjAuMiIsCiAg\nICAidGFwZSI6ICJeNS4wLjEiCiAgfQp9Cg==\n",
"encoding": "base64",
"_links": {
"self": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/package.json?ref=master",
"git": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs/2806b7a4ce0a7caf6f1e3d9c0a833c81db97f7eb",
"html": "https://github.com/vikram-raj/hello-func-node-env/blob/master/package.json"
}
}
@@ -0,0 +1,105 @@
{
"id": 582727984,
"node_id": "R_kgDOIru5MA",
"name": "hello-func-node-env",
"full_name": "vikram-raj/hello-func-node-env",
"private": false,
"owner": {
"login": "vikram-raj",
"id": 2561818,
"node_id": "MDQ6VXNlcjI1NjE4MTg=",
"avatar_url": "https://avatars.githubusercontent.com/u/2561818?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/vikram-raj",
"html_url": "https://github.com/vikram-raj",
"followers_url": "https://api.github.com/users/vikram-raj/followers",
"following_url": "https://api.github.com/users/vikram-raj/following{/other_user}",
"gists_url": "https://api.github.com/users/vikram-raj/gists{/gist_id}",
"starred_url": "https://api.github.com/users/vikram-raj/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/vikram-raj/subscriptions",
"organizations_url": "https://api.github.com/users/vikram-raj/orgs",
"repos_url": "https://api.github.com/users/vikram-raj/repos",
"events_url": "https://api.github.com/users/vikram-raj/events{/privacy}",
"received_events_url": "https://api.github.com/users/vikram-raj/received_events",
"type": "User",
"site_admin": false
},
"html_url": "https://github.com/vikram-raj/hello-func-node-env",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/vikram-raj/hello-func-node-env",
"forks_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/forks",
"keys_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/teams",
"hooks_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/hooks",
"issue_events_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/issues/events{/number}",
"events_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/events",
"assignees_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/assignees{/user}",
"branches_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/branches{/branch}",
"tags_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/tags",
"blobs_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/statuses/{sha}",
"languages_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/languages",
"stargazers_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/stargazers",
"contributors_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contributors",
"subscribers_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/subscribers",
"subscription_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/subscription",
"commits_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/contents/{+path}",
"compare_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/merges",
"archive_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/downloads",
"issues_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/issues{/number}",
"pulls_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/pulls{/number}",
"milestones_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/milestones{/number}",
"notifications_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/labels{/name}",
"releases_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/releases{/id}",
"deployments_url": "https://api.github.com/repos/vikram-raj/hello-func-node-env/deployments",
"created_at": "2022-12-27T17:45:59Z",
"updated_at": "2022-12-27T17:47:32Z",
"pushed_at": "2022-12-27T17:47:28Z",
"git_url": "git://github.com/vikram-raj/hello-func-node-env.git",
"ssh_url": "git@github.com:vikram-raj/hello-func-node-env.git",
"clone_url": "https://github.com/vikram-raj/hello-func-node-env.git",
"svn_url": "https://github.com/vikram-raj/hello-func-node-env",
"homepage": null,
"size": 45,
"stargazers_count": 0,
"watchers_count": 0,
"language": "JavaScript",
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"has_discussions": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"license": null,
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [

],
"visibility": "public",
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "master",
"temp_clone_token": null,
"network_count": 0,
"subscribers_count": 1
}

0 comments on commit 276a844

Please sign in to comment.