Skip to content

Commit

Permalink
Adding dependencies and working on testing
Browse files Browse the repository at this point in the history
  • Loading branch information
zachseifts committed Apr 9, 2020
1 parent cc13ac4 commit b4cdb6f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
testing.py
*.swp
*.pyc
env
Expand Down
20 changes: 15 additions & 5 deletions jeep/maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,24 @@

from datetime import datetime

from github import Github

class Maintenance:
''' A base maintenance class.
'''

def __init__(self):
self.has_ran = False
self.label = u'Maintenance'
self.assignee = 'zachseifts'
self.repo = 'zachseifts/jeeps'
self.repo_name = 'zachseifts/jeeps'

def create(self):
''' This function creates an issue in the repo
'''
self.has_ran = True
self.repo.create_issue(
title=self.title,
body=self.body,
labels=[self.label],
assignee=self.assignee)


class GreaseJob(Maintenance):
Expand All @@ -35,5 +39,11 @@ def __init__(self, **kwargs):
self.title = u'Monthly: Grease job and inspection'
self.body = u'It is time to check on the jeep.'
super().__init__()
self.create()

def run(self):
if self.account_token:
self.github = Github(self.account_token)
self.repo = self.github.get_repo(self.repo_name)
self.label = self.repo.get_label('Maintenance')
self.create()

3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
],
install_requires=[
'pygithub',
],
python_requires='>=3.7',
)

6 changes: 2 additions & 4 deletions tests/test_maintenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
def test_greasejob():
''' This test tests the GreaseJob object.
'''
g = GreaseJob()
assert g.label == 'Maintenance'
g = GreaseJob(account_token='1')
assert g.assignee == 'zachseifts'
assert g.repo == 'zachseifts/jeeps'
assert g.repo_name == 'zachseifts/jeeps'
assert g.title == 'Monthly: Grease job and inspection'
assert g.body == 'It is time to check on the jeep.'
assert g.has_ran

0 comments on commit b4cdb6f

Please sign in to comment.