def testRegisterUserTeamWrongCode(self): team = self.authenticated_client.team data = self.default_data() data.update({ 'team_id': team.tid, 'team_name': None, 'team_code': 'xxx', }) with self.client: with self.queryLimit(1): resp = self.postJSON('/api/users', data) self.assert400(resp)
def testRegisterUserTeamNoCode(self): team = self.authenticated_client.team data = self.default_data() data.update({ 'team_id': team.tid, 'team_name': None, 'team_code': 'xxx', }) with self.client as c: with self.queryLimit(1): resp = self.postJSON('/api/users', data) self.assert400(resp)
def testRegisterUserExistingTeam(self): team = self.authenticated_client.team data = self.default_data() data.update({ 'team_id': team.tid, 'team_name': None, 'team_code': team.code, }) with self.client: with self.queryLimit(8): resp = self.postJSON('/api/users', data) self.assert200(resp) self.assertItemsEqual(self.USER_FIELDS, resp.json.keys()) self.assertEqual(resp.json['uid'], flask.session['user']) self.assertEqual(resp.json['admin'], flask.session['admin']) self.assertEqual(resp.json['team_tid'], flask.session['team']) self.assertEqual(team.tid, resp.json['team_tid'])