def testGetReportContentLeagueSpecifiedSomeMatches(self): report = LeagueFixturesReport() report.leagueId = "aafagf" report.leagueName = "sgasdlghsdlkghsdakgsd" match = MatchInReport() match.date = datetime.date(2013, 10, 10) match.time = datetime.time(18, 15) match.court = "A" match.homeTeamId = "sadgsadg" match.homeTeamName = "fdhdahadhfa" match.awayTeamId = "sadsgasdg" match.awayTeamName = "hsdfhsdfhs" report.matches.append(match) result = LeagueFixtures("").getReportContent(report) expectedResult = """ <h1>sgasdlghsdlkghsdakgsd</h1> <p class="noprint">Click on a team to see all matches for that team.</p> <table id="fixlist"> <tbody class="nobreak"> <tr> <td class="date" colspan="3">10th October 2013</td> </tr> <tr> <td class="time">6:15</td> <td class="court">A</td> <td class="teams"> <a href="/cgi-bin/page.py?id=teamFixtures&team=sadgsadg">fdhdahadhfa</a> v <a href="/cgi-bin/page.py?id=teamFixtures&team=sadsgasdg">hsdfhsdfhs</a> </td> </tr> </tbody> </table> """ self.assertMultiLineEqual(expectedResult, result)
def testGetMatchLinePrevTimeSame(self): match = MatchInReport() match.date = datetime.date(2013, 10, 6) match.time = datetime.time(16, 15) match.court = "A" match.homeTeamId = "IBMSouthHants" match.homeTeamName = "IBM South Hants" match.awayTeamId = "HavantA" match.awayTeamName = "Havant A" prevTime = datetime.time(16, 15) result = LeagueFixtures("").getMatchLine(match, prevTime) expectedResult = """ <tr> <td class="time"></td> <td class="court">A</td> <td class="teams"> <a href="/cgi-bin/page.py?id=teamFixtures&team=IBMSouthHants">IBM South Hants</a> v <a href="/cgi-bin/page.py?id=teamFixtures&team=HavantA">Havant A</a> </td> </tr> """ self.assertMultiLineEqual(expectedResult, result)
def testGetMatchLinesForDateMatchesAtDifferentTimes(self): theDate = datetime.date(2013, 10, 13) matches = [] match = MatchInReport() match.date = datetime.date(2013, 10, 10) match.time = datetime.time(21, 15) match.court = "A" match.homeTeamId = "aaa" match.homeTeamName = "asagasgh" match.awayTeamId = "bbb" match.awayTeamName = "sgsdsdgsd" matches.append(match) match = MatchInReport() match.date = datetime.date(2013, 10, 10) match.time = datetime.time(19, 15) match.court = "B" match.homeTeamId = "sdfgfds" match.homeTeamName = "sASGHSDAS" match.awayTeamId = "asda" match.awayTeamName = "ffjfdf" matches.append(match) result = LeagueFixtures("").getMatchLines(theDate, matches) expectedResult = """ <tbody class="nobreak"> <tr> <td class="date" colspan="3">13th October 2013</td> </tr> <tr> <td class="time">7:15</td> <td class="court">B</td> <td class="teams"> <a href="/cgi-bin/page.py?id=teamFixtures&team=sdfgfds">sASGHSDAS</a> v <a href="/cgi-bin/page.py?id=teamFixtures&team=asda">ffjfdf</a> </td> </tr> <tr> <td class="time">9:15</td> <td class="court">A</td> <td class="teams"> <a href="/cgi-bin/page.py?id=teamFixtures&team=aaa">asagasgh</a> v <a href="/cgi-bin/page.py?id=teamFixtures&team=bbb">sgsdsdgsd</a> </td> </tr> </tbody> """ self.assertMultiLineEqual(expectedResult, result)
def testGetFixtureList(self): matches = [] match = MatchInReport() match.date = datetime.date(2012, 10, 10) match.time = datetime.time(19, 15) match.court = "A" match.homeTeamId = "aaa" match.homeTeamName = "asagasgh" match.awayTeamId = "bbb" match.awayTeamName = "sgsdsdgsd" matches.append(match) match = MatchInReport() match.date = datetime.date(2013, 10, 10) match.time = datetime.time(19, 15) match.court = "B" match.homeTeamId = "sdfgfds" match.homeTeamName = "sASGHSDAS" match.awayTeamId = "asda" match.awayTeamName = "ffjfdf" matches.append(match) match = MatchInReport() match.date = datetime.date(2013, 10, 10) match.time = datetime.time(18, 15) match.court = "A" match.homeTeamId = "sadgsadg" match.homeTeamName = "fdhdahadhfa" match.awayTeamId = "sadsgasdg" match.awayTeamName = "hsdfhsdfhs" matches.append(match) report = LeagueFixturesReport() report.leagueId = "aafagf" report.leagueName = "sgasdlghsdlkghsdakgsd" report.matches = matches result = LeagueFixtures("").getFixtureList(report) expectedResult = """ <p class="noprint">Click on a team to see all matches for that team.</p> <table id="fixlist"> <tbody class="nobreak"> <tr> <td class="date" colspan="3">10th October 2012</td> </tr> <tr> <td class="time">7:15</td> <td class="court">A</td> <td class="teams"> <a href="/cgi-bin/page.py?id=teamFixtures&team=aaa">asagasgh</a> v <a href="/cgi-bin/page.py?id=teamFixtures&team=bbb">sgsdsdgsd</a> </td> </tr> </tbody> <tbody class="nobreak"> <tr> <td class="date" colspan="3">10th October 2013</td> </tr> <tr> <td class="time">6:15</td> <td class="court">A</td> <td class="teams"> <a href="/cgi-bin/page.py?id=teamFixtures&team=sadgsadg">fdhdahadhfa</a> v <a href="/cgi-bin/page.py?id=teamFixtures&team=sadsgasdg">hsdfhsdfhs</a> </td> </tr> <tr> <td class="time">7:15</td> <td class="court">B</td> <td class="teams"> <a href="/cgi-bin/page.py?id=teamFixtures&team=sdfgfds">sASGHSDAS</a> v <a href="/cgi-bin/page.py?id=teamFixtures&team=asda">ffjfdf</a> </td> </tr> </tbody> </table> """ self.assertMultiLineEqual(expectedResult, result)