예제 #1
0
class HttpResponseBuilder(Builder):
    target = HttpResponse

    body = a_string
    status_code = lambda: one_of(*[s.value for s in http.HTTPStatus])
    headers = lambda: one_of(None, {a_string(): a_string()})
    mode = lambda: one_of(*Response.Mode)
예제 #2
0
파일: builders.py 프로젝트: ozonru/mbtest
class ProxyBuilder(Builder):
    target = Proxy

    to = UrlBuilder
    wait = lambda: one_of(None, an_integer(1, 1000))
    inject_headers = lambda: one_of(None, {a_string(): a_string()})
    mode = lambda: one_of(*Proxy.Mode)
예제 #3
0
class HttpRequestBuilder(Builder):
    target = HttpRequest

    method = lambda: one_of(*Predicate.Method).name
    path = lambda: UrlBuilder().build().path
    query = lambda: {a_string(): a_string(), a_string(): a_string()}
    headers = lambda: {a_string(): a_string(), a_string(): a_string()}
    body = lambda: one_of(None, a_string())
예제 #4
0
파일: builders.py 프로젝트: ozonru/mbtest
class ImposterBuilder(Builder):
    target = Imposter

    stubs = lambda: [StubBuilder().build(), StubBuilder().build()]
    port = lambda: one_of(None, an_integer(1, 5000))
    protocol = one_of(*Imposter.Protocol)
    name = lambda: one_of(None, a_string())
    record_requests = a_boolean
예제 #5
0
파일: builders.py 프로젝트: ozonru/mbtest
class ResponseBuilder(Builder):
    target = Response

    body = a_string
    status_code = lambda: one_of(*[s.value for s in http.HTTPStatus])
    wait = lambda: one_of(an_integer(1, 500), None)
    repeat = lambda: one_of(an_integer(2, 50), None)
    headers = lambda: one_of(None, {a_string(): a_string()})
    mode = lambda: one_of(*Response.Mode)
    copy = lambda: one_of(None, CopyBuilder().build())
    decorate = lambda: one_of(None, a_string())
    lookup = lambda: one_of(None, LookupBuilder().build())
    shell_transform = lambda: one_of(None, a_string())
예제 #6
0
class CopyBuilder(Builder):
    target = Copy

    from_ = a_string
    into = a_string
    using = lambda: one_of(UsingRegexBuilder().build(),
                           UsingXpathBuilder().build(),
                           UsingJsonpathBuilder().build())
예제 #7
0
class KeyBuilder(Builder):
    target = Key

    from_ = a_string
    using = lambda: one_of(UsingRegexBuilder().build(),
                           UsingXpathBuilder().build(),
                           UsingJsonpathBuilder().build())
    index = lambda: an_integer(1, 50)
예제 #8
0
class UrlBuilder(Builder):
    target = furl

    scheme = lambda: one_of("http", "https", "tcp", None)
    username = a_string
    password = a_string
    host = DomainBuilder
    port = lambda: an_integer(1, 65535)
    path = lambda: [a_string(), a_string()]
    query = lambda: {a_string(): a_string(), a_string(): a_string()}
    fragment = a_string
예제 #9
0
class PredicateBuilder(Builder):
    target = Predicate

    path = lambda: one_of(None, a_string())
    method = lambda: one_of(*Predicate.Method)
    query = lambda: one_of(None, {a_string(): a_string()})
    body = lambda: one_of(None, a_string())
    headers = lambda: one_of(None, {a_string(): a_string()})
    xpath = lambda: one_of(None, a_string())
    operator = lambda: one_of(*list(Predicate.Operator))
    case_sensitive = a_boolean
예제 #10
0
class ResponseBuilder(Builder):
    target = Response

    wait = lambda: one_of(an_integer(1, 500), None)
    repeat = lambda: one_of(an_integer(2, 50), None)
    copy = lambda: one_of(None, CopyBuilder().build())
    decorate = lambda: one_of(None, a_string())
    lookup = lambda: one_of(None, LookupBuilder().build())
    shell_transform = lambda: one_of(None, a_string())
    http_response = HttpResponseBuilder
예제 #11
0
class ImposterBuilder(Builder):
    target = Imposter

    stubs = lambda: [StubBuilder().build(), StubBuilder().build()]
    port = lambda: one_of(None, an_integer(1, 5000))
    protocol = one_of(*Imposter.Protocol)
    name = lambda: one_of(None, a_string())
    default_response = lambda: one_of(None, HttpResponseBuilder().build())
    record_requests = a_boolean
    mutual_auth = a_boolean
    key = lambda: one_of(None, a_string())
    cert = lambda: one_of(None, a_string())
예제 #12
0
class DomainBuilder(Builder):
    subdomain = lambda: a_string(characters=string.ascii_lowercase)
    tld = lambda: one_of("com", "net", "dev", "co.uk", "gov.uk", "ng")

    def build(self):
        return "{0}.{1}".format(self.subdomain, self.tld)
예제 #13
0
class ResponseBuilder(Builder):
    target = Response

    body = a_string
    status_code = lambda: one_of(
        200,
        201,
        202,
        203,
        204,
        205,
        206,
        207,
        208,
        226,
        300,
        301,
        302,
        303,
        304,
        305,
        307,
        308,
        400,
        401,
        402,
        403,
        404,
        405,
        406,
        407,
        408,
        409,
        410,
        411,
        412,
        413,
        414,
        415,
        416,
        417,
        418,
        421,
        422,
        423,
        424,
        426,
        428,
        429,
        431,
        444,
        451,
        499,
        500,
        501,
        502,
        503,
        504,
        505,
        506,
        507,
        508,
        510,
        511,
        599,
    )
    wait = lambda: one_of(an_integer(1, 500), None)
    repeat = lambda: one_of(an_integer(2, 50), None)
    headers = lambda: one_of(None, {a_string(): a_string()})
    mode = lambda: one_of(*Response.Mode)
    copy = lambda: one_of(None, CopyBuilder().build())
    decorate = lambda: one_of(None, a_string())
    lookup = lambda: one_of(None, LookupBuilder().build())
    shell_transform = lambda: one_of(None, a_string())