Skip to content

Commit

Permalink
fix: create and update github commands #264 (#291)
Browse files Browse the repository at this point in the history
* Fix create and update github commands #264

	- Change get_file_contents to get_contents
	- Remove beginning '/' on paths

* Fix the unit tests
  • Loading branch information
mrrsm committed Feb 23, 2022
1 parent e1df17f commit 14ba352
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions statuspage/statuspage.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def run_upgrade(name, token, org):
content = f.read()
if template in files:
repo_template = repo.get_contents(
path="/" + template,
path=template,
ref=head_sha,
)
if not is_same_content(
Expand Down Expand Up @@ -177,7 +177,7 @@ def run_update(name, token, org):

# get the template from the repo
template_file = repo.get_contents(
path="/template.html",
path="template.html",
ref=sha
)

Expand All @@ -196,7 +196,7 @@ def run_update(name, token, org):
try:
# get the index.html file, we need the sha to update it
index = repo.get_contents(
path="/index.html",
path="index.html",
ref=sha,
)

Expand Down
5 changes: 3 additions & 2 deletions statuspage/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import unittest
import traceback
from datetime import datetime
from unittest import TestCase
from mock import patch, Mock
Expand Down Expand Up @@ -50,8 +51,8 @@ def setUp(self):
self.template = Mock()
self.template.decoded_content = b"some foo"
self.template.content = codecs.encode(b"some other foo", "base64")
self.gh().get_user().get_repo().get_file_contents.return_value = self.template
self.gh().get_organization().get_repo().get_file_contents.return_value = self.template
self.gh().get_user().get_repo().get_contents.return_value = self.template
self.gh().get_organization().get_repo().get_contents.return_value = self.template

self.collaborator = Mock()
self.collaborator.login = "some-dude"
Expand Down

0 comments on commit 14ba352

Please sign in to comment.