Ejemplo n.º 1
0
    def test_it_fails_fast_when_flag_is_set(self):
        HttpStub.set_response_codes(500, 200)
        cmd = command.do("./backdrop-send "
                         "--url http://localhost:8000/data_set "
                         "--token token "
                         "--failfast", stdin='{"key": "value"}')

        assert_that(cmd.exit_status, is_(8))
Ejemplo n.º 2
0
    def test_it_passes_after_default_number_of_retries(self):
        HttpStub.set_response_codes(500, 500, 200)
        cmd = command.do("./backdrop-send "
                         "--url http://localhost:8000/data_set "
                         "--sleep 0 "
                         "--token data_set-auth-token", stdin='{"key": "value"}')

        assert_that(cmd.exit_status, is_(0))
Ejemplo n.º 3
0
    def test_it_reports_http_errors(self):
        HttpStub.set_response_codes(500)
        cmd = command.do("./backdrop-send "
                         "--url http://localhost:8000/data_set "
                         "--token data_set-auth-token", stdin='{"key": "value"}')

        assert_that(cmd.exit_status, is_not(0))
        assert_that(cmd.stderr, contains_string("Unable to send to backdrop"))
        assert_that(cmd.stderr, contains_string("500"))
Ejemplo n.º 4
0
    def test_it_fails_fast_when_flag_is_set(self):
        HttpStub.set_response_codes(500, 200)
        cmd = command.do(
            "./backdrop-send "
            "--url http://localhost:8000/data_set "
            "--token token "
            "--failfast",
            stdin='{"key": "value"}')

        assert_that(cmd.exit_status, is_(8))
Ejemplo n.º 5
0
    def test_it_reports_authorization_errors(self):
        HttpStub.set_response_codes(403)
        cmd = command.do("./backdrop-send "
                         "--url http://localhost:8000/data_set "
                         "--token wrong-token", stdin='{"key": "value"}')

        assert_that(cmd.exit_status, is_not(0))
        assert_that(cmd.stderr, contains_string(
            "Unable to send to backdrop. "
            "Unauthorised: check your access token."))