def test_update_registered_users(self):
     """Tests to see that if a user is registered, his fb id
     can be found"""
     client = pymongo.MongoClient()
     user_collection = client['test']['users']
     users = [x for x in user_collection.find()]
     updated = night.update_all_tournament_matches(get_tournament_data
             ('sab-gb3champ'))
     for user in users:
         night.update_registered_user_matches(updated, user)
     self.assertTrue(client['test']['users'].find({'facebook_id': 1}))
 def test_update_winner_loser(self):
     """Tests to see that winner and loser id are
     updated correctly"""
     updated = night.update_all_tournament_matches(get_tournament_data
             ('sab-gb3champ'))
     matches = updated['matches']
     for count in xrange(len(matches)):
         winner_success = isinstance(
                 matches[count]['match']['winner_id'], (str, unicode))
         loser_success = isinstance(
                 matches[count]['match']['loser_id'], (str, unicode))
         self.assertTrue(winner_success)
         self.assertTrue(loser_success)