aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pathod/test_context.py
blob: 8db4331f7b094fb8f07b3ac49599933c07ea794f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import requests
from pathod import test


def test_simple():
    """
        Testing the requests module with
        a pathod context manager.
    """
    # Start pathod in a separate thread
    with test.Daemon() as d:
        # Get a URL for a pathod spec
        url = d.p("200:b@100")
        # ... and request it
        r = requests.put(url)

        # Check the returned data
        assert r.status_code == 200
        assert len(r.content) == 100

        # Check pathod's internal log
        log = d.last_log()["request"]
        assert log["method"] == "PUT"
-color: #fff0f0 } /* Comment.Special */ .highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/ {
	#address-cells = <1>;
	#size-cells = <1>;
	compatible = "lantiq,falcon";

	cpus {
		cpu@0 {
			compatible = "mips,mips34kc";
		};
	};

	localbus@10000000 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "lantiq,localbus", "simple-bus";
		reg = <0x10000000 0xC000000>;
		ranges = <0x0 0x10000000 0xC000000>;
	};

	ebu@18000000 {
		compatible = "lantiq,ebu-falcon";
		reg = <0x18000000 0x100>;
	};

	sbs2@1D000000 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "lantiq,sysb2", "simple-bus";
		reg = <0x1D000000 0x1000000>;
		ranges = <0x0 0x1D000000 0x1000000>;

		sysgpe@700000 {
			compatible = "lantiq,sysgpe-falcon";
			reg = <0x700000 0x100>;
		};

		gpio0: gpio@810000 {
			#gpio-cells = <2>;
			compatible = "lantiq,gpio-falcon";
			gpio-controller;
			interrupt-parent = <&icu0>;
			interrupts = <44>;
			reg = <0x810000 0x80>;
			lantiq,bank = <0>;
		};

		gpio2: gpio@810100 {
			#gpio-cells = <2>;
			compatible = "lantiq,gpio-falcon";
			gpio-controller;
			interrupt-parent = <&icu0>;
			interrupts = <46>;
			reg = <0x810100 0x80>;
			lantiq,bank = <2>;
		};

		syseth@B00000 {
			compatible = "lantiq,syseth-falcon";
			reg = <0xB00000 0x100>;
		};

		pad@B01000 {
			compatible = "lantiq,pad-falcon";
			reg = <0xB01000 0x100>;
			lantiq,bank = <0>;
		};

		pad@B02000 {
			compatible = "lantiq,pad-falcon";
			reg = <0xB02000 0x100>;
			lantiq,bank = <2>;
		};
	};

	fpi@1E000000 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "lantiq,fpi", "simple-bus";
		reg = <0x1E000000 0x1000000>;
		ranges = <0x0 0x1E000000 0x1000000>;

		serial@100B00 {
			status = "disabled";
			compatible = "lantiq,asc";
			reg = <0x100B00 0x100>;
			interrupt-parent = <&icu0>;
			interrupts = <104 105 106>;
			line = <1>;
		};

		serial@100C00 {
			compatible = "lantiq,asc";
			reg = <0x100C00 0x100>;
			interrupt-parent = <&icu0>;
			interrupts = <104 105 106>;
			line = <0>;
		};

		i2c@200000 {
			compatible = "lantiq,lantiq-i2c";
			reg = <0x200000 0x10000>;
			interrupt-parent = <&icu0>;
			interrupts = <18 19 20 21>;
			gpios = <&gpio1 7 0 &gpio1 8 0>;
		};

		gpio1: gpio@800100 {
			#gpio-cells = <2>;
			compatible = "lantiq,gpio-falcon";
			gpio-controller;
			interrupt-parent = <&icu0>;
			interrupts = <45>;
			reg = <0x800100 0x100>;
			lantiq,bank = <1>;
		};

		gpio3: gpio@800200 {
			status = "disabled";
			#gpio-cells = <2>;
			compatible = "lantiq,gpio-falcon";
			gpio-controller;
			interrupt-parent = <&icu0>;
			interrupts = <47>;
			reg = <0x800200 0x100>;
			lantiq,bank = <3>;
		};

		gpio4: gpio@800300 {
			status = "disabled";
			#gpio-cells = <2>;
			compatible = "lantiq,gpio-falcon";
			gpio-controller;
			interrupt-parent = <&icu0>;
			interrupts = <48>;
			reg = <0x800300 0x100>;
			lantiq,bank = <4>;
		};

		pad@800400 {
			compatible = "lantiq,pad-falcon";
			reg = <0x800400 0x100>;
			lantiq,bank = <1>;
		};

		pad@800500 {
			status = "disabled";
			compatible = "lantiq,pad-falcon";
			reg = <0x800500 0x100>;
			bank = <3>;
		};

		pad4@800600 {
			status = "disabled";
			compatible = "lantiq,pad-falcon";
			reg = <0x800600 0x100>;
			bank = <4>;
		};

		status@802000 {
			compatible = "lantiq,status-falcon";
			reg = <0x802000 0x80>;
		};

		sys1@F00000 {
			compatible = "lantiq,sys1-falcon";
			reg = <0xF00000 0x100>;
		};
	};

	sbs0@1F000000 {

	};

	sbs1@1F700000 {

	};

	biu@1F800000 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "lantiq,falcon";
		reg = <0x1F800000 0x800000>;
		ranges = <0x0 0x1F800000 0x7FFFFF>;

		icu0: icu@80200 {
			#interrupt-cells = <1>;
			interrupt-controller;
			compatible = "lantiq,icu";
			reg = <0x80200 0x28
				0x80228 0x28
				0x80250 0x28
				0x80278 0x28
				0x802a0 0x28>;
		};

		watchdog@803F0 {
			compatible = "lantiq,wdt";
			reg = <0x803F0 0x10>;
		};
	};
};