Ejemplo n.º 1
0
    def test_api_error(self):
        self.server.add(
            url='/user',
            params='action=getApiKey&method=PUT&username=u&password=p',
            response='{"error": "your foo went bar"}')
        with ShouldRaise(WorkfrontAPIError(u'your foo went bar', 200)):
            with OutputCapture() as output:
                main()

        output.compare("")
Ejemplo n.º 2
0
    def test_api_error(self):
        self.server.add(
            url='/user',
            params='action=getApiKey&method=PUT&username=u&password=p',
            response='{"error": "your foo went bar"}'
        )
        with ShouldRaise(WorkfrontAPIError(u'your foo went bar', 200)):
            with OutputCapture() as output:
                main()

        output.compare("")
Ejemplo n.º 3
0
    def test_functional(self):
        self.server.add(
            url='/user',
            params='action=getApiKey&method=PUT&username=u&password=p',
            response='{"data": {"result": "xyz"}}')
        with OutputCapture() as output:
            main()

        if PY2:
            expected = "Your API key is: u'xyz'"
        else:
            expected = "Your API key is: 'xyz'"
        output.compare(expected)
Ejemplo n.º 4
0
    def test_functional(self):
        self.server.add(
            url='/user',
            params='action=getApiKey&method=PUT&username=u&password=p',
            response='{"data": {"result": "xyz"}}'
        )
        with OutputCapture() as output:
            main()

        if PY2:
            expected="Your API key is: u'xyz'"
        else:
            expected="Your API key is: 'xyz'"
        output.compare(expected)