def test_teammate_remove(self): """ Adds new teammate """ request = self.factory.post(reverse('taskmng:team_invitable'), {"cmd": "add", "item": json.dumps({"id": 2})}) request.user = self.user team_invitable(request) request = self.factory.post(reverse('taskmng:team_invitable'), {"cmd": "del", "tmId": 1}) request.user = self.user response_json = team_invitable(request) response = json.loads(response_json.content) self.assertEqual(response['result'], 'ok')
def test_team_view_no_auth(self): """ Response status must be 302. """ request = self.factory.get(reverse('taskmng:team_invitable')) request.user = AnonymousUser() response = team_invitable(request) self.assertEqual(response.status_code, 302)
def test_team_invitable(self): """ Returns team invitable view """ request = self.factory.get(reverse('taskmng:team_invitable')) request.user = self.user response_json = team_invitable(request) response = json.loads(response_json.content) self.assertEqual(len(response), 1)