Skip to content

Commit

Permalink
Merge pull request #5 from gmfrasca/update-schedule-fall2017
Browse files Browse the repository at this point in the history
Update schedule fall2017
  • Loading branch information
gmfrasca authored Sep 8, 2017
2 parents b427cb9 + 983cca1 commit 951bbd9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
8 changes: 3 additions & 5 deletions psgroupme/bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,14 @@ def get_bot_specific_responses(self):
schedule = self.schedule.get_schedule()

nextgame_resp = self.NEXTGAME_RESPONSE.format(str(next_game))
lastgame_resp = self.LASTGAME_RESPONSE.format(str(
self.schedule.get_last_game()))
schedule_resp = self.SCHEDULE_RESPONSE.format(str(
self.schedule.get_schedule()))
lastgame_resp = self.LASTGAME_RESPONSE.format(str(last_game))
schedule_resp = self.SCHEDULE_RESPONSE.format(str(schedule))

if next_game is None:
nextgame_resp = "There are no games left on the schedule :("
if last_game is None:
lastgame_resp = "The season hasn't started yet"
if schedule is None:
if schedule is None or len(self.schedule.games) < 1:
schedule_resp = "No schedule yet :("

responses = [
Expand Down
2 changes: 2 additions & 0 deletions psgroupme/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@


def main():
"""Start up a Flask REST API Frontent"""
# Setup the Flask App
app = Flask(__name__)
api = Api(app)

# Add Bots to a REST API URL here
api.add_resource(bots.ScheduleBot, '/schedulebot')
api.add_resource(bots.HockeyBot, '/hockeybot')

# Start up the REST API
app.run(host='0.0.0.0', port='5002')
Expand Down
2 changes: 1 addition & 1 deletion psgroupme/team_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Poinstreak URL info
PS_URL = 'http://stats.pointstreak.com'
SCHED_EXT = 'players/players-team-schedule.html'
SCHED_PARAMS = 'teamid=666456&seasonid=17266'
SCHED_PARAMS = 'teamid=666456&seasonid=17455'
SCHEDULE_URL = '{0}/{1}?{2}'.format(PS_URL, SCHED_EXT, SCHED_PARAMS)

# Expected Column Data Contents
Expand Down
4 changes: 3 additions & 1 deletion tests/test_bots.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class PointstreakScheduleMock(PointstreakSchedule):

def __init__(self, *args, **kwargs):
self.html_table = mock.MagicMock()
self.games = mock.MagicMock()
self.games = [self.get_last_game_before(),
self.get_next_game_after()]

def __repr__(self):
return 'TestSchedule'
Expand Down Expand Up @@ -211,6 +212,7 @@ def test_excludes_specialized_replies(self):

@mock.patch.object(psgroupme.bots.ScheduleBot, 'respond')
def test_real_responses(self, mock_resp):

# Canned responses
nextgame_resp = self.bot.NEXTGAME_RESPONSE.format('TestNextGame')
lastgame_resp = self.bot.LASTGAME_RESPONSE.format('TestLastGame')
Expand Down

0 comments on commit 951bbd9

Please sign in to comment.