import responses
from matrix_client import client


class TestTagsApi:
    cli = client.MatrixClient("https://example.com")
    user_id = "@user:matrix.org"
    room_id = "#foo:matrix.org"

    @responses.activate
    def test_get_user_tags(self):

        tags_url = "https://example.com" \
            "/_matrix/client/r0/user/@user:matrix.org/rooms/#foo:matrix.org/tags"
        responses.add(responses.GET, tags_url, body='{}')
        self.cli.api.get_user_tags(self.user_id, self.room_id)
        req = responses.calls[0].request
        assert req.url == tags_url
        assert req.method == 'GET'

    @responses.activate
    def test_add_user_tags(self):
        tags_url = "https://example.com" \
            "/_matrix/client/r0/user/@user:matrix.org/rooms/#foo:matrix.org/tags/foo"
        responses.add(responses.PUT, tags_url, body='{}')
        self.cli.api.add_user_tag(self.user_id, self.room_id, "foo", body={"order": "5"})
        req = responses.calls[0].request
        assert req.url == tags_url
        assert req.method == 'PUT'

    @responses.activate
    def test_remove_user_tags(self):
        tags_url = "https://example.com" \
            "/_matrix/client/r0/user/@user:matrix.org/rooms/#foo:matrix.org/tags/foo"
        responses.add(responses.DELETE, tags_url, body='{}')
        self.cli.api.remove_user_tag(self.user_id, self.room_id, "foo")
        req = responses.calls[0].request
        assert req.url == tags_url
        assert req.method == 'DELETE'

@@ -95,25 +95,24 @@
 Client(%22http
-s
 ://example.c
@@ -116,16 +116,16 @@
 e.com%22)%0A
+
     user
@@ -240,17 +240,16 @@
 (self):%0A
-%0A
         
@@ -256,33 +256,32 @@
 tags_url = %22http
-s
 ://example.com%22 
@@ -671,33 +671,32 @@
 tags_url = %22http
-s
 ://example.com%22 
@@ -1128,17 +1128,16 @@
  = %22http
-s
 ://examp
@@ -1433,32 +1433,32 @@
 url == tags_url%0A
-
         assert r
@@ -1479,8 +1479,1079 @@
 DELETE'%0A
+%0A%0Aclass TestAccountDataApi:%0A    cli = client.MatrixClient(%22http://example.com%22)%0A    user_id = %22@user:matrix.org%22%0A    room_id = %22#foo:matrix.org%22%0A%0A    @responses.activate%0A    def test_set_account_data(self):%0A        account_data_url = %22http://example.com%22 %5C%0A            %22/_matrix/client/r0/user/@user:matrix.org/account_data/foo%22%0A        responses.add(responses.PUT, account_data_url, body='%7B%7D')%0A        self.cli.api.set_account_data(self.user_id, 'foo', %7B'bar': 1%7D)%0A        req = responses.calls%5B0%5D.request%0A        assert req.url == account_data_url%0A        assert req.method == 'PUT'%0A%0A    @responses.activate%0A    def test_set_room_account_data(self):%0A        account_data_url = %22http://example.com/_matrix/client/r0/user%22 %5C%0A            %22/@user:matrix.org/rooms/#foo:matrix.org/account_data/foo%22%0A        responses.add(responses.PUT, account_data_url, body='%7B%7D')%0A        self.cli.api.set_room_account_data(self.user_id, self.room_id, 'foo', %7B'bar': 1%7D)%0A        req = responses.calls%5B0%5D.request%0A        assert req.url == account_data_url%0A        assert req.method == 'PUT'%0A

Add Api Tests for account_data