Beispiel #1
0
    def test_unique_domains(self):
        """Check whether domains are unique"""

        with self.assertRaisesRegexp(IntegrityError, DUP_CHECK_ERROR):
            org1 = Organization(name='Example')
            self.session.add(org1)

            dom1 = Domain(domain='example.com')
            dom1.organization = org1
            dom2 = Domain(domain='example.com')
            dom2.organization = org1

            self.session.add(dom1)
            self.session.add(dom2)
            self.session.commit()
Beispiel #2
0
    def test_unique_domains(self):
        """Check whether domains are unique"""

        with self.assertRaisesRegexp(IntegrityError, DUP_CHECK_ERROR):
            org1 = Organization(name='Example')
            self.session.add(org1)

            dom1 = Domain(domain='example.com')
            dom1.organization = org1
            dom2 = Domain(domain='example.com')
            dom2.organization = org1

            self.session.add(dom1)
            self.session.add(dom2)
            self.session.commit()
Beispiel #3
0
    def test_is_top_domain_invalid_type(self):
        """Check invalid values on top_domain bool collumn"""

        with self.assertRaisesRegexp(StatementError, INVALID_DATATYPE_ERROR):
            org1 = Organization(name='Example')
            self.session.add(org1)

            dom1 = Domain(domain='example.com', is_top_domain='True')
            dom1.organization = org1

            self.session.add(dom1)
            self.session.commit()
Beispiel #4
0
    def test_is_top_domain_invalid_type(self):
        """Check invalid values on top_domain bool collumn"""

        with self.assertRaisesRegexp(StatementError, INVALID_DATATYPE_ERROR):
            org1 = Organization(name='Example')
            self.session.add(org1)

            dom1 = Domain(domain='example.com', is_top_domain='True')
            dom1.organization = org1

            self.session.add(dom1)
            self.session.commit()
    def test_none_name_domains(self):
        """Check whether domains without name can be stored"""

        with self.assertRaisesRegex(IntegrityError, NULL_CHECK_ERROR):
            org1 = Organization(name='Example')
            self.session.add(org1)

            dom1 = Domain()
            dom1.organization = org1

            self.session.add(dom1)
            self.session.commit()
    def test_none_name_domains(self):
        """Check whether domains without name can be stored"""

        with self.assertRaisesRegex(IntegrityError, NULL_CHECK_ERROR):
            org1 = Organization(name='Example')
            self.session.add(org1)

            dom1 = Domain()
            dom1.organization = org1

            self.session.add(dom1)
            self.session.commit()
Beispiel #7
0
    def test_none_name_domains(self):
        """Check whether domains without name can be stored"""

        if sys.version_info[0] >= 3:  # Python 3
            expected = IntegrityError
        else:  # Python 2
            expected = OperationalError

        with self.assertRaisesRegexp(expected, NULL_CHECK_ERROR):
            org1 = Organization(name='Example')
            self.session.add(org1)

            dom1 = Domain()
            dom1.organization = org1

            self.session.add(dom1)
            self.session.commit()
Beispiel #8
0
    def test_none_name_domains(self):
        """Check whether domains without name can be stored"""

        if sys.version_info[0] >= 3: # Python 3
            expected = IntegrityError
        else: # Python 2
            expected = OperationalError

        with self.assertRaisesRegexp(expected, NULL_CHECK_ERROR):
            org1 = Organization(name='Example')
            self.session.add(org1)

            dom1 = Domain()
            dom1.organization = org1

            self.session.add(dom1)
            self.session.commit()