コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
 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)