Esempio n. 1
0
 def testGetReportContent(self):
     report = TeamFixturesReport()
     report.teamId = "IBMSouthHants"
     report.teamName = "IBM South Hants"
     report.leagueId = "Division3"
     report.leagueName = "Division 3"
     report.matches = []
     match = MatchInReport()
     match.datetime = datetime.datetime(2013, 1, 20, 21, 15)
     match.opponentId = "Corinthians"
     match.opponentName = "Corinthians"
     match.court = "B"
     match.home = False
     match.result = "Lost"
     match.margin = "4 wickets"
     report.matches.append(match)
     match = MatchInReport()
     match.datetime = datetime.datetime(2012, 10, 7, 18, 15)
     match.opponentId = "PortsmouthB"
     match.opponentName = "Portsmouth B"
     match.court = "A"
     match.home = True
     match.result = None
     match.margin = None
     report.matches.append(match)
     result = TeamFixtures("").getReportContent(report)
     expectedResult = """
     <h1>IBM South Hants (<a href="/cgi-bin/page.py?id=leagueFixtures&league=Division3">Division 3</a>)</h1>
     <table id="teamfix">
         <thead>
             <tr>
                 <th class="date">Date</th>
                 <th class="time">Time</th>
                 <th class="court">Court</th>
                 <th class="opponent">Opponent</th>
                 <th class="homeAway">H/A</th>
             </tr>
         </thead>
         <tbody>
             <tr>
                 <td class="date">7th Oct 12</td>
                 <td class="time">6:15</td>
                 <td class="court">A</td>
                 <td class="opponent"><a href="/cgi-bin/page.py?id=teamFixtures&team=PortsmouthB">Portsmouth B</a></td>
                 <td class="homeAway">H</td>
                 <td class="result"></td>
             </tr>
             <tr>
                 <td class="date">20th Jan 13</td>
                 <td class="time">9:15</td>
                 <td class="court">B</td>
                 <td class="opponent"><a href="/cgi-bin/page.py?id=teamFixtures&team=Corinthians">Corinthians</a></td>
                 <td class="homeAway">A</td>
                 <td class="result"><a href="/cgi-bin/page.py?id=leagueResults&league=Division3#CorinthiansIBMSouthHants">Lost by 4 wickets</a></td>
             </tr>
         </tbody>
     </table>
     """
     self.assertMultiLineEqual(expectedResult, result)
Esempio n. 2
0
 def testGetReportContent(self):
     report = TeamFixturesReport()
     report.teamId = "IBMSouthHants"
     report.teamName = "IBM South Hants"
     report.leagueId = "Division3"
     report.leagueName = "Division 3"
     report.matches = []
     match = MatchInReport()
     match.datetime = datetime.datetime(2013, 1, 20, 21, 15)
     match.opponentId = "Corinthians"
     match.opponentName = "Corinthians"
     match.court = "B"
     match.home = False
     match.result = "Lost"
     match.margin = "4 wickets"
     report.matches.append(match)
     match = MatchInReport()
     match.datetime = datetime.datetime(2012, 10, 7, 18, 15)
     match.opponentId = "PortsmouthB"
     match.opponentName = "Portsmouth B"
     match.court = "A"
     match.home = True
     match.result = None
     match.margin = None
     report.matches.append(match)
     result = TeamFixtures("").getReportContent(report)
     expectedResult = """
     <h1>IBM South Hants (<a href="/cgi-bin/page.py?id=leagueFixtures&league=Division3">Division 3</a>)</h1>
     <table id="teamfix">
         <thead>
             <tr>
                 <th class="date">Date</th>
                 <th class="time">Time</th>
                 <th class="court">Court</th>
                 <th class="opponent">Opponent</th>
                 <th class="homeAway">H/A</th>
             </tr>
         </thead>
         <tbody>
             <tr>
                 <td class="date">7th Oct 12</td>
                 <td class="time">6:15</td>
                 <td class="court">A</td>
                 <td class="opponent"><a href="/cgi-bin/page.py?id=teamFixtures&team=PortsmouthB">Portsmouth B</a></td>
                 <td class="homeAway">H</td>
                 <td class="result"></td>
             </tr>
             <tr>
                 <td class="date">20th Jan 13</td>
                 <td class="time">9:15</td>
                 <td class="court">B</td>
                 <td class="opponent"><a href="/cgi-bin/page.py?id=teamFixtures&team=Corinthians">Corinthians</a></td>
                 <td class="homeAway">A</td>
                 <td class="result"><a href="/cgi-bin/page.py?id=leagueResults&league=Division3#CorinthiansIBMSouthHants">Lost by 4 wickets</a></td>
             </tr>
         </tbody>
     </table>
     """
     self.assertMultiLineEqual(expectedResult, result)
Esempio n. 3
0
 def testGetMatchLineNotPlayed(self):
     teamId = "HavantA"
     leagueResLink = PageLink("leagueResults", TeamFixtures(""), {"league": "Division1"})
     match = MatchInReport()
     match.opponentId = "FarehamCroftonB"
     match.opponentName = "Fareham & Crofton B"
     match.datetime = datetime.datetime(2012, 9, 30, 18, 15)
     match.court = "B"
     match.home = True
     match.result = None
     match.margin = None
     result = TeamFixtures("").getMatchLine(match, teamId, leagueResLink)
     expectedResult = """
     <tr>
     <td class="date">30th Sep 12</td>
     <td class="time">6:15</td>
     <td class="court">B</td>
     <td class="opponent"><a href="/cgi-bin/page.py?id=teamFixtures&team=FarehamCroftonB">Fareham & Crofton B</a></td>
     <td class="homeAway">H</td>
     <td class="result"></td>
     </tr>
     """
     self.assertMultiLineEqual(expectedResult, result)
Esempio n. 4
0
 def testGetMatchLineNotPlayed(self):
     teamId = "HavantA"
     leagueResLink = PageLink("leagueResults", TeamFixtures(""),
                              {"league": "Division1"})
     match = MatchInReport()
     match.opponentId = "FarehamCroftonB"
     match.opponentName = "Fareham & Crofton B"
     match.datetime = datetime.datetime(2012, 9, 30, 18, 15)
     match.court = "B"
     match.home = True
     match.result = None
     match.margin = None
     result = TeamFixtures("").getMatchLine(match, teamId, leagueResLink)
     expectedResult = """
     <tr>
     <td class="date">30th Sep 12</td>
     <td class="time">6:15</td>
     <td class="court">B</td>
     <td class="opponent"><a href="/cgi-bin/page.py?id=teamFixtures&team=FarehamCroftonB">Fareham & Crofton B</a></td>
     <td class="homeAway">H</td>
     <td class="result"></td>
     </tr>
     """
     self.assertMultiLineEqual(expectedResult, result)