def testEmail(self): """Test email parameter""" mocker = MockLeague(self) # non existent player name expect = [] email = "*****@*****.**" rv = self.app.post(Routes['vplayerLookup'], data={'email': email}) self.output(expect) self.output(loads(rv.data)) self.assertEqual(expect, loads(rv.data), Routes['vplayerLookup'] + ": invalid email") # a valid email expect = [mocker.get_players()[0]] email = mocker.get_player_email(0) rv = self.app.post(Routes['vplayerLookup'], data={'email': email}) self.output(expect) self.output(loads(rv.data)) self.assertEqual(expect, loads(rv.data), Routes['vplayerLookup'] + ": valid email")
def testEmail(self): """Tests using a player email as a parameter""" mocker = MockLeague(self) league = mocker.get_league() team = mocker.get_teams()[0] player = mocker.get_players()[0] sponsor = mocker.get_sponsor() # test a test player emails params = {'email': mocker.get_player_email(0)} rv = self.app.post(Routes['vplayerteamLookup'], data=params) expect = [{ 'captain': player, 'color': team['color'], 'espys': 0, 'league_id': league['league_id'], 'sponsor_id': sponsor['sponsor_id'], 'team_id': team['team_id'], 'team_name': team['team_name'], 'year': team['year'] }] self.output(loads(rv.data)) self.output(expect) self.assertEqual(expect, loads(rv.data), Routes['vplayerteamLookup'])