Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Wilfredo Sanchez committed Nov 19, 2013
1 parent cdcd032 commit 7ccba34
Showing 1 changed file with 47 additions and 38 deletions.
85 changes: 47 additions & 38 deletions twext/who/test/test_directory.py
Expand Up @@ -77,7 +77,7 @@ def test_init(self):

def test_repr(self):
"""
C{repr} returns the expected string.
L{DirectoryService.repr} returns the expected string.
"""
service = self.service()
self.assertEquals(
Expand All @@ -88,9 +88,9 @@ def test_repr(self):

def test_recordTypes(self):
"""
C{recordTypes} returns the supported set of record types.
For L{DirectoryService}, that's the set of constants in the
C{recordType} attribute.
L{DirectoryService.recordTypes} returns the supported set of record
types. For L{DirectoryService}, that's the set of constants in the
L{DirectoryService.recordType} attribute.
"""
service = self.service()
self.assertEquals(
Expand All @@ -101,8 +101,8 @@ def test_recordTypes(self):

def test_recordsFromNonCompoundExpression_unknownExpression(self):
"""
C{recordsFromNonCompoundExpression} with an unknown expression type
fails with L{QueryNotSupportedError}.
L{DirectoryService.recordsFromNonCompoundExpression} with an unknown
expression type fails with L{QueryNotSupportedError}.
"""
service = self.service()
self.assertFailure(
Expand All @@ -114,8 +114,8 @@ def test_recordsFromNonCompoundExpression_unknownExpression(self):
@inlineCallbacks
def test_recordsFromNonCompoundExpression_emptyRecords(self):
"""
C{recordsFromNonCompoundExpression} with an unknown expression type
and an empty C{records} set returns an empty result.
L{DirectoryService.recordsFromNonCompoundExpression} with an unknown
expression type and an empty C{records} set returns an empty result.
"""
service = self.service()
result = (
Expand All @@ -128,8 +128,9 @@ def test_recordsFromNonCompoundExpression_emptyRecords(self):

def test_recordsFromNonCompoundExpression_nonEmptyRecords(self):
"""
C{recordsFromNonCompoundExpression} with an unknown expression type
and a non-empty C{records} fails with L{QueryNotSupportedError}.
L{DirectoryService.recordsFromNonCompoundExpression} with an unknown
expression type and a non-empty C{records} fails with
L{QueryNotSupportedError}.
"""
service = self.service()

Expand All @@ -152,8 +153,8 @@ def test_recordsFromNonCompoundExpression_nonEmptyRecords(self):

def test_recordsFromExpression_unknownExpression(self):
"""
C{recordsFromExpression} with an unknown expression type fails with
L{QueryNotSupportedError}.
L{DirectoryService.recordsFromExpression} with an unknown expression
type fails with L{QueryNotSupportedError}.
"""
service = self.service()
result = yield(service.recordsFromExpression(object()))
Expand All @@ -163,8 +164,8 @@ def test_recordsFromExpression_unknownExpression(self):
@inlineCallbacks
def test_recordsFromExpression_emptyExpression(self):
"""
C{recordsFromExpression} with an unknown expression type and an empty
L{CompoundExpression} returns an empty result.
L{DirectoryService.recordsFromExpression} with an unknown expression
type and an empty L{CompoundExpression} returns an empty result.
"""
service = self.service()

Expand Down Expand Up @@ -208,19 +209,22 @@ def test_removeRecordsEmpty(self):



class DirectoryServiceRecordsFromExpressionTest(unittest.TestCase):
class DirectoryServiceRecordsFromExpressionTest(
unittest.TestCase,
ServiceMixIn
):
"""
Tests for L{DirectoryService}.
Tests for L{DirectoryService.recordsFromExpression}.
"""
serviceClass = DirectoryService
directoryRecordClass = DirectoryRecord

@inlineCallbacks
def test_recordsFromExpression_single(self):
"""
C{recordsFromExpression} handles a single expression
L{DirectoryService.recordsFromExpression} handles a single expression.
"""
service = StubDirectoryService()
service = self.service()

result = yield service.recordsFromExpression("twistedmatrix.com")

Expand All @@ -238,10 +242,10 @@ def test_recordsFromExpression_single(self):
@inlineCallbacks
def test_recordsFromExpression_OR(self):
"""
C{recordsFromExpression} handles a L{CompoundExpression} with
L{Operand.OR}.
L{DirectoryService.recordsFromExpression} handles a
L{CompoundExpression} with L{Operand.OR}.
"""
service = StubDirectoryService()
service = self.service()

result = yield service.recordsFromExpression(
CompoundExpression(
Expand Down Expand Up @@ -270,10 +274,10 @@ def test_recordsFromExpression_OR(self):
@inlineCallbacks
def test_recordsFromExpression_AND(self):
"""
C{recordsFromExpression} handles a L{CompoundExpression} with
L{Operand.AND}.
L{DirectoryService.recordsFromExpression} handles a
L{CompoundExpression} with L{Operand.AND}.
"""
service = StubDirectoryService()
service = self.service()

result = yield service.recordsFromExpression(
CompoundExpression(
Expand All @@ -297,11 +301,11 @@ def test_recordsFromExpression_AND(self):
@inlineCallbacks
def test_recordsFromExpression_AND_optimized(self):
"""
C{recordsFromExpression} handles a L{CompoundExpression} with
L{Operand.AND}, and when one of the expression matches no records, the
subsequent expressions are skipped.
L{DirectoryService.recordsFromExpression} handles a
L{CompoundExpression} with L{Operand.AND}, and when one of the
expression matches no records, the subsequent expressions are skipped.
"""
service = StubDirectoryService()
service = self.service()

result = yield service.recordsFromExpression(
CompoundExpression(
Expand All @@ -327,10 +331,11 @@ def test_recordsFromExpression_AND_optimized(self):

def test_recordsFromExpression_unknownOperand(self):
"""
C{recordsFromExpression} fails with L{QueryNotSupportedError} when
given a L{CompoundExpression} with an unknown operand.
L{DirectoryService.recordsFromExpression} fails with
L{QueryNotSupportedError} when given a L{CompoundExpression} with an
unknown operand.
"""
service = StubDirectoryService()
service = self.service()

results = service.recordsFromExpression(
CompoundExpression(
Expand Down Expand Up @@ -359,7 +364,7 @@ class DirectoryServiceConvenienceTest(

def test_recordWithUID(self):
"""
C{recordWithUID} fails with L{QueryNotSupportedError}.
L{DirectoryService.recordWithUID} fails with L{QueryNotSupportedError}.
"""
service = self.service()

Expand All @@ -371,7 +376,8 @@ def test_recordWithUID(self):

def test_recordWithGUID(self):
"""
C{recordWithGUID} fails with L{QueryNotSupportedError}.
L{DirectoryService.recordWithGUID} fails with
L{QueryNotSupportedError}.
"""
service = self.service()

Expand All @@ -383,7 +389,8 @@ def test_recordWithGUID(self):

def test_recordsWithRecordType(self):
"""
C{recordsWithRecordType} fails with L{QueryNotSupportedError}.
L{DirectoryService.recordsWithRecordType} fails with
L{QueryNotSupportedError}.
"""
service = self.service()

Expand All @@ -396,7 +403,8 @@ def test_recordsWithRecordType(self):

def test_recordWithShortName(self):
"""
C{recordWithShortName} fails with L{QueryNotSupportedError}.
L{DirectoryService.recordWithShortName} fails with
L{QueryNotSupportedError}.
"""
service = self.service()

Expand All @@ -409,7 +417,8 @@ def test_recordWithShortName(self):

def test_recordsWithEmailAddress(self):
"""
C{recordsWithEmailAddress} fails with L{QueryNotSupportedError}.
L{DirectoryService.recordsWithEmailAddress} fails with
L{QueryNotSupportedError}.
"""
service = self.service()

Expand Down Expand Up @@ -634,7 +643,7 @@ def test_initNormalizeEmailLowercase(self):

def test_repr(self):
"""
C{repr} returns the expected string.
L{DirectoryRecord.repr} returns the expected string.
"""
wsanchez = self.makeRecord(self.fields_wsanchez)

Expand Down Expand Up @@ -697,7 +706,7 @@ def test_attributeAccess(self):

def test_description(self):
"""
C{description} returns the expected string.
L{DirectoryRecord.description} returns the expected string.
"""
sagen = self.makeRecord(self.fields_sagen)

Expand Down

0 comments on commit 7ccba34

Please sign in to comment.