def testJoinMatchUserAlreadyInMatch(self):
     user = Bunch()
     self.match.players.append(user)
     self.assertEqual(main.join(user, self.match).status_code, 403)  # Precondition failed
     self.assertEqual(len(self.match.players), 1)
 def testJoinMatch(self):
     user = Bunch(name="user")
     response = main.join(user, self.match)
     self.assertEqual(response.status_code, 302)
     self.assertTrue(user in self.match.players)
 def testJoinMatchNoUser(self):
     self.assertEqual(main.join(None, self.match).status_code, 403)  # Unauthorized
     # assert(joinMatch(None, match) explains that theres no user) #Unauthorized
     self.assertEqual(len(self.match.players), 0)