Esempio n. 1
0
 def TestUsageExamples(self):
     """
     Rather un-exciting test but at least the code is exercised and expected
     behaviour checked.
     """
     u = HTTPUsage('/dummy', 'an example of great profundity')
     request = 'foo'
     response = 'bar'
     description = 'baz'
     example = HTTPExample(request, response, description)
     u.addExample(example)
     self.assertEqual(1, len(u.examples))
     self.assertEqual('foo', u.examples[0].request)
     self.assertEqual('bar', u.examples[0].response)
     self.assertEqual('baz', u.examples[0].description)
Esempio n. 2
0
        "tag" : "mike/comment",
        "updated-at" : "2012-02-22T04:03:31.850967",
        "username" : "mike",
        "value" : "I had to annotate my own tweet about annotating tweets."
      },
     { "about" : "http://www.sublimetext.com/",
        "id" : "362f95bd-5429-4a3d-90f7-576860ea7bac",
        "tag" : "ceronman/comment",
        "updated-at" : "2012-02-22T15:00:16.957497",
        "username" : "ceronman",
        "value" : "Very cool text editor."
      }]""")

description = dedent("""
    Retrieve information about recent values on objects followed by bob.""")
usage.addExample(HTTPExample(request, response, description))

usage.addReturn(Return(apiDoc.BAD_REQUEST, 'If no query is given.'))
usage.addReturn(Return(apiDoc.BAD_REQUEST,
                       'The query string was not valid UTF-8.'))
usage.addReturn(Return(apiDoc.BAD_REQUEST,
                       'If the query string could not be parsed.'))
usage.addReturn(Return(apiDoc.BAD_REQUEST,
                       'If the query returns to many objects.'))
usage.addReturn(Return(apiDoc.NOT_FOUND,
                       'If one or more of the tags or namespaces present '
                       'in the query do not exist.'))
usage.addReturn(Return(apiDoc.UNAUTHORIZED,
                       'If the user does not have ' + apiDoc.READ +
                       ' permission on a tag whose value is needed '
                       'to satisfy the query.'))
Esempio n. 3
0
                    "value" : "http://bit.ly/4bYAV2",
                    "updated-at" : "2012-02-13T18:15:24.571150"
                }
            }
        }
    }
}
''' % resultsKey

description = '''
Search for objects in Fluidinfo matching mike/rating > 5 and retrieve values
for the tags <span class="tag">ntoll/rating</span>,
<span class="tag">ntoll/resume</span>, <span class="tag">fluiddb/about</span>,
and <span class="tag">bit.ly/url</span> from those objects.'''

usage.addExample(HTTPExample(request, response, description))

# ------------------------------ Values PUT -----------------------------
topLevel = HTTPTopLevel(httpValueCategoryName, 'PUT')

topLevel.description = """The PUT method on values sets tag values
    on objects matching queries.  Unknown namespaces and tags are created
    automatically."""

registry.register(topLevel)

# --- PUT /values -----------------------------------------------------

usage = HTTPUsage(
    '', """Search for objects matching a series of Fluidinfo queries, and set
    the values of the given tags on the matching objects.""")