예제 #1
0
    def test_delete_uses_custom_base_url(self):
        self.stub_delete_requests()
        client = Client(access_token="1a2bc3", base_url="https://example.com")

        client.delete("/messages/3")

        self.assert_delete_request("https://example.com/messages/3.json")
예제 #2
0
    def test_delete_uses_custom_base_url(self):
        self.stub_delete_requests()
        client = Client(access_token="1a2bc3", base_url="https://example.com")

        client.delete("/messages/3")

        self.assert_delete_request("https://example.com/messages/3.json")
예제 #3
0
    def test_delete_uses_default_base_url(self):
        self.stub_delete_requests()
        client = Client(access_token="abc123")

        client.delete("/messages/1")

        self.assert_delete_request("https://www.yammer.com/api/v1/messages/1.json")
예제 #4
0
    def test_delete_uses_default_base_url(self):
        self.stub_delete_requests()
        client = Client(access_token="abc123")

        client.delete("/messages/1")

        self.assert_delete_request(
            "https://www.yammer.com/api/v1/messages/1.json")
예제 #5
0
    def test_delete_does_not_send_authorization_header_with_no_token(self):
        self.stub_delete_requests()
        client = Client(access_token=None)

        client.delete("/messages/14")

        self.assert_delete_request(
            url="https://www.yammer.com/api/v1/messages/14.json",
            headers={},
        )
예제 #6
0
    def test_delete_sends_query_string_parameters(self):
        self.stub_delete_requests()
        client = Client(access_token="456efg")

        client.delete("/messages/liked_by/current", message_id=12345)

        self.assert_delete_request(
            url="https://www.yammer.com/api/v1/messages/liked_by/current.json",
            params={"message_id": 12345},
        )
예제 #7
0
    def test_delete_sends_authorization_header(self):
        self.stub_delete_requests()
        client = Client(access_token="abc123")

        client.delete("/users/123")

        self.assert_delete_request(
            url="https://www.yammer.com/api/v1/users/123.json",
            headers={"Authorization": "Bearer abc123"},
        )
예제 #8
0
    def test_delete_does_not_send_authorization_header_with_no_token(self):
        self.stub_delete_requests()
        client = Client(access_token=None)

        client.delete("/messages/14")

        self.assert_delete_request(
            url="https://www.yammer.com/api/v1/messages/14.json",
            headers={},
        )
예제 #9
0
    def test_delete_sends_query_string_parameters(self):
        self.stub_delete_requests()
        client = Client(access_token="456efg")

        client.delete("/messages/liked_by/current", message_id=12345)

        self.assert_delete_request(
            url="https://www.yammer.com/api/v1/messages/liked_by/current.json",
            params={"message_id": 12345},
        )
예제 #10
0
    def test_delete_sends_authorization_header(self):
        self.stub_delete_requests()
        client = Client(access_token="abc123")

        client.delete("/users/123")

        self.assert_delete_request(
            url="https://www.yammer.com/api/v1/users/123.json",
            headers={"Authorization": "Bearer abc123"},
        )
예제 #11
0
    def test_delete_handles_success_with_a_blank_body(self):
        self.stub_delete_requests(response_status=200, response_body=" ")
        client = Client(access_token="foobar")

        response = client.delete("/messages/123")

        self.assertEquals(response, True)
예제 #12
0
    def test_delete_parses_response_json(self):
        self.stub_delete_requests(response_body='{"deleted": true}', )
        client = Client(access_token="abc123")

        response = client.delete("/messages/1")

        self.assertEqual(response.deleted, True)
예제 #13
0
    def test_delete_handles_success_with_a_blank_body(self):
        self.stub_delete_requests(response_status=200, response_body=" ")
        client = Client(access_token="foobar")

        response = client.delete("/messages/123")

        self.assertEquals(response, True)
예제 #14
0
    def test_delete_parses_response_json(self):
        self.stub_delete_requests(
            response_body='{"deleted": true}',
        )
        client = Client(access_token="abc123")

        response = client.delete("/messages/1")

        self.assertEqual(response.deleted, True)