From e4213a5868ee322e4e7b8c93831550a8f07651bf Mon Sep 17 00:00:00 2001 From: Jakub Adamski Date: Wed, 8 Jun 2022 10:30:04 +0200 Subject: [PATCH 1/2] init github api mock --- github/apimock.py | 87 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 github/apimock.py diff --git a/github/apimock.py b/github/apimock.py new file mode 100644 index 0000000..d502402 --- /dev/null +++ b/github/apimock.py @@ -0,0 +1,87 @@ +#Possible actions: +# - create repository +# - delete repository +# - list repositories +# - list respository issues +# - list repository pull requests +# - list notifications +# - list repository tests + +repositoriesMock = ["repo1", "repo2", "repo3"] +issuesMock = [ + { + "name": "Issue 1", + "description": "Description of issue 1", + "status": "open" + }, + { + "name": "Issue 2", + "description": "Description of issue 2", + "status": "closed" + } +] +pullRequestMock = [ + { + "name": "pull request 1", + "description": "description 1", + "state": "open" + }, + { + "name": "pull request 2", + "description": "description 2", + "state": "open" + } +] +notificationsMock = [ + { + "name": "notification 1", + "description": "description 1" + }, + { + "name": "notification 2", + "description": "description 2" + } +] +testMock = [ + { + "name": "test1", + "description": "test1 description", + "status": "passed" + }, + { + "name": "test2", + "description": "test2 description", + "status": "failed" + }, +] + +def createRepository(repositoryName): + print("Creating repository: " + repositoryName) + return True + +def deleteRepository(repositoryName): + print("Deleting repository: " + repositoryName) + return True + +def listRepositories(): + print("Listing repositories: " + str(repositoriesMock)) + return True + +def listRepositoryIssues(repositoryName): + print("Listing issues for repository: " + repositoryName) + print(issuesMock) + return True + +def listRepositoryPullRequests(repositoryName): + print("Listing pull requests for repository: " + repositoryName) + print(pullRequestMock) + return True + +def listNotifications(): + print("Listing notifications: " + str(notificationsMock)) + return True + +def listRepositoryTests(repositoryName): + print("Listing tests for repository: " + repositoryName) + print(testMock) + return True \ No newline at end of file From 2036a1b85523343f80270bd173f0949bf55547fd Mon Sep 17 00:00:00 2001 From: Jakub Adamski Date: Wed, 8 Jun 2022 12:38:10 +0200 Subject: [PATCH 2/2] changed return data --- github/apimock.py | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/github/apimock.py b/github/apimock.py index d502402..781c8e8 100644 --- a/github/apimock.py +++ b/github/apimock.py @@ -56,32 +56,22 @@ testMock = [ ] def createRepository(repositoryName): - print("Creating repository: " + repositoryName) - return True + pass def deleteRepository(repositoryName): - print("Deleting repository: " + repositoryName) - return True + pass def listRepositories(): - print("Listing repositories: " + str(repositoriesMock)) - return True + return repositoriesMock def listRepositoryIssues(repositoryName): - print("Listing issues for repository: " + repositoryName) - print(issuesMock) - return True + return issuesMock def listRepositoryPullRequests(repositoryName): - print("Listing pull requests for repository: " + repositoryName) - print(pullRequestMock) - return True + return pullRequestMock def listNotifications(): - print("Listing notifications: " + str(notificationsMock)) - return True + return notificationsMock def listRepositoryTests(repositoryName): - print("Listing tests for repository: " + repositoryName) - print(testMock) - return True \ No newline at end of file + return testMock \ No newline at end of file