Exemplo n.º 1
0
    def testNoOrgTypeClub(self):
        form_data = {
            'name': "Test",
            'description': 'Club Description',
            'contact_email': '*****@*****.**'
        };

        form = AddClubForm(self.user, form_data);

        self.assertTrue(not form.is_valid());
Exemplo n.º 2
0
    def testNoEmailClub(self):
        form_data = {
            'name': 'Test',
            'description': 'Club Description',
            'contact_email': '',
            'organization_type': 1
        };

        form = AddClubForm(self.user, form_data);

        self.assertTrue(not form.is_valid());
Exemplo n.º 3
0
    def testNameTooLongClub(self):
        form_data = {
            'name': "a"*129,
            'description': 'Club Description',
            'contact_email': '*****@*****.**',
            'organization_type': 1
        };

        form = AddClubForm(self.user, form_data);

        self.assertTrue(not form.is_valid());
Exemplo n.º 4
0
    def testEmailTooLongClub(self):
        email_gt_128 = ("a"*120) + "@test.com";

        self.assertTrue(len(email_gt_128) > 128);

        form_data = {
            'name': "Test",
            'description': 'Club Description',
            'contact_email': email_gt_128,
            'organization_type': 1
        };

        form = AddClubForm(self.user, form_data);

        self.assertTrue(not form.is_valid());
Exemplo n.º 5
0
    def testValidClub2(self):
        form_data = {
            'name': 'Test Club',
            'contact_email': '*****@*****.**',
            'organization_type': 1
        };

        form = AddClubForm(self.user, form_data);

        self.assertTrue(form.is_valid());

        form.save();

        test_club = Organization.objects.get(name='Test Club');

        self.assertTrue(test_club.name == 'Test Club');
        self.assertTrue(test_club.description == '');
        self.assertTrue(test_club.contact_email == '*****@*****.**');
Exemplo n.º 6
0
    def testValidClub3(self):
        form_data = {
            'name': "a"*128,
            'description': 'Club Description',
            'contact_email': '*****@*****.**',
            'organization_type': 2
        };

        form = AddClubForm(self.user, form_data);

        self.assertTrue(form.is_valid());

        form.save();

        test_club = Organization.objects.get(name="a"*128);

        self.assertTrue(test_club.name == "a"*128);
        self.assertTrue(test_club.description == 'Club Description');
        self.assertTrue(test_club.contact_email == '*****@*****.**');
Exemplo n.º 7
0
    def testValidClub4(self):
        email_128 = ("a"*119) + "@test.com";

        self.assertTrue(len(email_128) == 128);

        form_data = {
            'name': "Test",
            'description': 'Club Description',
            'contact_email': email_128,
            'organization_type': 2
        };

        form = AddClubForm(self.user, form_data);

        self.assertTrue(form.is_valid());

        form.save();

        test_club = Organization.objects.get(name="Test");

        self.assertTrue(test_club.name == "Test");
        self.assertTrue(test_club.description == 'Club Description');
        self.assertTrue(test_club.contact_email == email_128);
Exemplo n.º 8
0
    def testEmailNotUnique(self):
        form_data1 = {
            'name': "Test 1",
            'description': 'Club Description 1',
            'contact_email': '*****@*****.**',
            'organization_type': 1
        };

        form_data2 = {
            'name': "Test 2",
            'description': 'Club Description 2',
            'contact_email': '*****@*****.**',
            'organization_type': 2
        };

        form = AddClubForm(self.user, form_data1);

        self.assertTrue(form.is_valid());

        form.save();

        form = AddClubForm(self.user, form_data2);

        self.assertTrue(not form.is_valid());