Package gavo :: Package rscdef :: Module regtest :: Class DataURL
[frames] | no frames]

Class DataURL

source code

                   object --+            
                            |            
 base.structure.StructureBase --+        
                                |        
                   object --+   |        
                            |   |        
           base.common.Parser --+        
                                |        
base.structure.ParseableStructure --+    
                                    |    
             base.structure.Structure --+
                                        |
                                       DataURL

A source document for a regression test.

As string URLs, they specify where to get data from, but the additionally let you specify uploads, authentication, headers and http methods, while at the same time saving you manual escaping of parameters.

The bodies is the path to run the test against. This is interpreted as relative to the RD if there's no leading slash, relative to the server if there's a leading slash, and absolute if there's a scheme.

The attributes are translated to parameters, except for a few pre-defined names. If you actually need those as URL parameters, should at us and we'll provide some way of escaping these.

We don't actually parse the URLs coming in here. GET parameters are appended with a & if there's a ? in the existing URL, with a ? if not. Again, shout if this is too dumb for you (but urlparse really isn't all that robust either...)

Nested Classes

Inherited from base.structure.StructureBase: __metaclass__

Instance Methods
 
getValue(self, serverURL)
returns a pair of full request URL and postable payload for this test.
source code
 
getParams(self)
returns the URL parameters as a sequence of kw, value pairs.
source code
 
retrieveResource(self, serverURL, timeout)
returns a triple of status, headers, and content for retrieving this URL.
source code
 
validate(self) source code
 
getAttribute(self, name)
Returns an attribute instance from name.
source code
 
getFullId(self) source code

Inherited from base.structure.Structure: __provides__, callCompletedCallbacks, completeElement, finishElement, onElementComplete

Inherited from base.structure.ParseableStructure: __init__, end_, feed, feedFrom, feedObject, iterEvents, start_, value_

Inherited from base.structure.StructureBase: __providedBy__, adopt, breakCircles, change, copy, getAttributes, getCopyableAttributes, getSourcePosition, iterChildren, setPosition

Inherited from base.common.Parser: feedEvent

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods

Inherited from base.structure.StructureBase: fromStructure

Class Variables
  name_ = 'url'
a sentinel for all kinds of undefined values.
  httpURL = '(not retrieved)'
  attrSeq = [<gavo.base.structure.DataContent object>, <gavo.bas...
  managedAttrs = {'content_': <gavo.base.structure.DataContent o...

Inherited from base.structure.Structure: __implemented__

Inherited from base.structure.StructureBase: completedCallbacks

Properties
  postPayload
  rd

Inherited from object: __class__

Method Details

validate(self)

source code 
Overrides: base.structure.Structure.validate

getAttribute(self, name)

source code 

Returns an attribute instance from name.

This function will raise a StructureError if no matching attribute definition is found.

Overrides: base.structure.ParseableStructure.getAttribute
(inherited documentation)

Class Variable Details

attrSeq

Value:
[<gavo.base.structure.DataContent object>,
 <gavo.base.attrdef.UnicodeAttribute object>,
 <gavo.base.complexattrs.DictAttribute object>,
 <gavo.base.attrdef.BooleanAttribute object>,
 <gavo.base.attrdef.UnicodeAttribute object>,
 <gavo.rscdef.common.ResdirRelativeAttribute object>,
 <gavo.base.complexattrs.StructListAttribute object>,
 <gavo.base.parsecontext.IdAttribute object>,
...

managedAttrs

Value:
{'content_': <gavo.base.structure.DataContent object>,
 'httpAuthKey': <gavo.base.attrdef.UnicodeAttribute object>,
 'httpHeader': <gavo.base.complexattrs.DictAttribute object>,
 'httpHonorRedirects': <gavo.base.attrdef.BooleanAttribute object>,
 'httpMethod': <gavo.base.attrdef.UnicodeAttribute object>,
 'httpUpload': <gavo.base.complexattrs.StructListAttribute object>,
 'id': <gavo.base.parsecontext.IdAttribute object>,
 'open': <gavo.rscdef.regtest.DynamicOpenVocAttribute object>,
...

Property Details

postPayload

Get Method:
unreachable.computePath(instance)
Set Method:
unreachable.setRelative(instance, value)

rd

Get Method:
unreachable._getRD(self)