Example #1
0
    def test_delete_resolve(self):
        # Delete a forward that points at a forward
        self.db.query(Forward
            ).filter_by(source='*****@*****.**'
            ).delete()

        # Resolve the remaining forwards
        update_resolved_forwards(self.db, '*****@*****.**')

        resolved = [r.destination for r in self.db.query(ResolvedForward
            ).filter_by(source='*****@*****.**')]
        self.assertEqual(resolved, ['*****@*****.**'])
Example #2
0
    def test_delete_resolve(self):
        # Delete a forward that points at a forward
        self.db.query(Forward).filter_by(source='*****@*****.**').delete()

        # Resolve the remaining forwards
        update_resolved_forwards(self.db, '*****@*****.**')

        resolved = [
            r.destination for r in self.db.query(ResolvedForward).filter_by(
                source='*****@*****.**')
        ]
        self.assertEqual(resolved, ['*****@*****.**'])
Example #3
0
    def test_simple_resolve(self):
        forward = Forward()
        forward.domain_id = 2
        forward.source = '*****@*****.**'
        forward.destination = '*****@*****.**'
        self.db.add(forward)
        self.db.commit()

        update_resolved_forwards(self.db, forward.source)

        resolved = self.db.query(ResolvedForward).filter_by(
            source=forward.source).first()
        self.assertEqual(resolved.destination, '*****@*****.**')
Example #4
0
    def test_simple_resolve(self):
        forward = Forward()
        forward.domain_id = 2
        forward.source = '*****@*****.**'
        forward.destination = '*****@*****.**'
        self.db.add(forward)
        self.db.commit()

        update_resolved_forwards(self.db, forward.source)

        resolved = self.db.query(ResolvedForward
            ).filter_by(source=forward.source
            ).first()
        self.assertEqual(resolved.destination, '*****@*****.**')
Example #5
0
    def test_complex_resolve(self):
        forward = Forward()
        forward.domain_id = 1
        forward.source = '*****@*****.**'
        forward.destination = '*****@*****.**'
        self.db.add(forward)
        self.db.commit()

        update_resolved_forwards(self.db, forward.source)

        resolved = []
        for forward in self.db.query(ResolvedForward
                ).filter_by(source=forward.source):
            resolved.append(forward.destination)

        self.assertEqual(resolved, ['*****@*****.**', '*****@*****.**'])
Example #6
0
    def test_complex_resolve(self):
        forward = Forward()
        forward.domain_id = 1
        forward.source = '*****@*****.**'
        forward.destination = '*****@*****.**'
        self.db.add(forward)
        self.db.commit()

        update_resolved_forwards(self.db, forward.source)

        resolved = []
        for forward in self.db.query(ResolvedForward).filter_by(
                source=forward.source):
            resolved.append(forward.destination)

        self.assertEqual(resolved,
                         ['*****@*****.**', '*****@*****.**'])