mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-28 07:00:51 +03:00
Fix flake8 warnings for tests
This commit is contained in:
parent
24d9f2c140
commit
700487a7c7
39 changed files with 359 additions and 364 deletions
|
@ -12,4 +12,3 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
|
@ -281,9 +281,9 @@ class AuthTestCase(unittest.TestCase):
|
||||||
macaroon.add_first_party_caveat("gen = 1")
|
macaroon.add_first_party_caveat("gen = 1")
|
||||||
macaroon.add_first_party_caveat("type = access")
|
macaroon.add_first_party_caveat("type = access")
|
||||||
macaroon.add_first_party_caveat("user_id = %s" % (user,))
|
macaroon.add_first_party_caveat("user_id = %s" % (user,))
|
||||||
macaroon.add_first_party_caveat("time < 1") # ms
|
macaroon.add_first_party_caveat("time < 1") # ms
|
||||||
|
|
||||||
self.hs.clock.now = 5000 # seconds
|
self.hs.clock.now = 5000 # seconds
|
||||||
|
|
||||||
yield self.auth.get_user_from_macaroon(macaroon.serialize())
|
yield self.auth.get_user_from_macaroon(macaroon.serialize())
|
||||||
# TODO(daniel): Turn on the check that we validate expiration, when we
|
# TODO(daniel): Turn on the check that we validate expiration, when we
|
||||||
|
|
|
@ -21,7 +21,6 @@ from tests.utils import (
|
||||||
MockHttpResource, DeferredMockCallable, setup_test_homeserver
|
MockHttpResource, DeferredMockCallable, setup_test_homeserver
|
||||||
)
|
)
|
||||||
|
|
||||||
from synapse.types import UserID
|
|
||||||
from synapse.api.filtering import Filter
|
from synapse.api.filtering import Filter
|
||||||
from synapse.events import FrozenEvent
|
from synapse.events import FrozenEvent
|
||||||
|
|
||||||
|
@ -356,7 +355,6 @@ class FilteringTestCase(unittest.TestCase):
|
||||||
"types": ["m.*"]
|
"types": ["m.*"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
user = UserID.from_string("@" + user_localpart + ":test")
|
|
||||||
filter_id = yield self.datastore.add_user_filter(
|
filter_id = yield self.datastore.add_user_filter(
|
||||||
user_localpart=user_localpart,
|
user_localpart=user_localpart,
|
||||||
user_filter=user_filter_json,
|
user_filter=user_filter_json,
|
||||||
|
@ -411,7 +409,6 @@ class FilteringTestCase(unittest.TestCase):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
user = UserID.from_string("@" + user_localpart + ":test")
|
|
||||||
filter_id = yield self.datastore.add_user_filter(
|
filter_id = yield self.datastore.add_user_filter(
|
||||||
user_localpart=user_localpart,
|
user_localpart=user_localpart,
|
||||||
user_filter=user_filter_json,
|
user_filter=user_filter_json,
|
||||||
|
@ -440,7 +437,6 @@ class FilteringTestCase(unittest.TestCase):
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
user = UserID.from_string("@" + user_localpart + ":test")
|
|
||||||
filter_id = yield self.datastore.add_user_filter(
|
filter_id = yield self.datastore.add_user_filter(
|
||||||
user_localpart=user_localpart,
|
user_localpart=user_localpart,
|
||||||
user_filter=user_filter_json,
|
user_filter=user_filter_json,
|
||||||
|
@ -476,12 +472,12 @@ class FilteringTestCase(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEquals(filter_id, 0)
|
self.assertEquals(filter_id, 0)
|
||||||
self.assertEquals(user_filter_json,
|
self.assertEquals(user_filter_json, (
|
||||||
(yield self.datastore.get_user_filter(
|
yield self.datastore.get_user_filter(
|
||||||
user_localpart=user_localpart,
|
user_localpart=user_localpart,
|
||||||
filter_id=0,
|
filter_id=0,
|
||||||
))
|
)
|
||||||
)
|
))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_filter(self):
|
def test_get_filter(self):
|
||||||
|
|
|
@ -2,6 +2,7 @@ from synapse.api.ratelimiting import Ratelimiter
|
||||||
|
|
||||||
from tests import unittest
|
from tests import unittest
|
||||||
|
|
||||||
|
|
||||||
class TestRatelimiter(unittest.TestCase):
|
class TestRatelimiter(unittest.TestCase):
|
||||||
|
|
||||||
def test_allowed(self):
|
def test_allowed(self):
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from synapse.appservice import ApplicationService
|
from synapse.appservice import ApplicationService
|
||||||
|
|
||||||
from mock import Mock, PropertyMock
|
from mock import Mock
|
||||||
from tests import unittest
|
from tests import unittest
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
from synapse.appservice import ApplicationServiceState, AppServiceTransaction
|
from synapse.appservice import ApplicationServiceState
|
||||||
from synapse.appservice.scheduler import (
|
from synapse.appservice.scheduler import (
|
||||||
_ServiceQueuer, _TransactionController, _Recoverer
|
_ServiceQueuer, _TransactionController, _Recoverer
|
||||||
)
|
)
|
||||||
|
@ -235,7 +235,7 @@ class ApplicationServiceSchedulerQueuerTestCase(unittest.TestCase):
|
||||||
srv_2_event2 = Mock(event_id="srv2b")
|
srv_2_event2 = Mock(event_id="srv2b")
|
||||||
|
|
||||||
send_return_list = [srv_1_defer, srv_2_defer]
|
send_return_list = [srv_1_defer, srv_2_defer]
|
||||||
self.txn_ctrl.send = Mock(side_effect=lambda x,y: send_return_list.pop(0))
|
self.txn_ctrl.send = Mock(side_effect=lambda x, y: send_return_list.pop(0))
|
||||||
|
|
||||||
# send events for different ASes and make sure they are sent
|
# send events for different ASes and make sure they are sent
|
||||||
self.queuer.enqueue(srv1, srv_1_event)
|
self.queuer.enqueue(srv1, srv_1_event)
|
||||||
|
|
|
@ -12,4 +12,3 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ from .. import unittest
|
||||||
from synapse.events import FrozenEvent
|
from synapse.events import FrozenEvent
|
||||||
from synapse.events.utils import prune_event
|
from synapse.events.utils import prune_event
|
||||||
|
|
||||||
|
|
||||||
class PruneEventTestCase(unittest.TestCase):
|
class PruneEventTestCase(unittest.TestCase):
|
||||||
""" Asserts that a new event constructed with `evdict` will look like
|
""" Asserts that a new event constructed with `evdict` will look like
|
||||||
`matchdict` when it is redacted. """
|
`matchdict` when it is redacted. """
|
||||||
|
|
|
@ -129,8 +129,6 @@ class AppServiceHandlerTestCase(unittest.TestCase):
|
||||||
self.assertEquals(result.room_id, room_id)
|
self.assertEquals(result.room_id, room_id)
|
||||||
self.assertEquals(result.servers, servers)
|
self.assertEquals(result.servers, servers)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def _mkservice(self, is_interested):
|
def _mkservice(self, is_interested):
|
||||||
service = Mock()
|
service = Mock()
|
||||||
service.is_interested = Mock(return_value=is_interested)
|
service.is_interested = Mock(return_value=is_interested)
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
|
|
||||||
import pymacaroons
|
import pymacaroons
|
||||||
|
|
||||||
from mock import Mock, NonCallableMock
|
|
||||||
from synapse.handlers.auth import AuthHandler
|
from synapse.handlers.auth import AuthHandler
|
||||||
from tests import unittest
|
from tests import unittest
|
||||||
from tests.utils import setup_test_homeserver
|
from tests.utils import setup_test_homeserver
|
||||||
|
|
|
@ -41,8 +41,10 @@ class ProfileTestCase(unittest.TestCase):
|
||||||
])
|
])
|
||||||
|
|
||||||
self.query_handlers = {}
|
self.query_handlers = {}
|
||||||
|
|
||||||
def register_query_handler(query_type, handler):
|
def register_query_handler(query_type, handler):
|
||||||
self.query_handlers[query_type] = handler
|
self.query_handlers[query_type] = handler
|
||||||
|
|
||||||
self.mock_federation.register_query_handler = register_query_handler
|
self.mock_federation.register_query_handler = register_query_handler
|
||||||
|
|
||||||
hs = yield setup_test_homeserver(
|
hs = yield setup_test_homeserver(
|
||||||
|
@ -63,7 +65,7 @@ class ProfileTestCase(unittest.TestCase):
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
|
|
||||||
self.frank = UserID.from_string("@1234ABCD:test")
|
self.frank = UserID.from_string("@1234ABCD:test")
|
||||||
self.bob = UserID.from_string("@4567:test")
|
self.bob = UserID.from_string("@4567:test")
|
||||||
self.alice = UserID.from_string("@alice:remote")
|
self.alice = UserID.from_string("@alice:remote")
|
||||||
|
|
||||||
yield self.store.create_profile(self.frank.localpart)
|
yield self.store.create_profile(self.frank.localpart)
|
||||||
|
@ -133,8 +135,9 @@ class ProfileTestCase(unittest.TestCase):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_set_my_avatar(self):
|
def test_set_my_avatar(self):
|
||||||
yield self.handler.set_avatar_url(self.frank, self.frank,
|
yield self.handler.set_avatar_url(
|
||||||
"http://my.server/pic.gif")
|
self.frank, self.frank, "http://my.server/pic.gif"
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
(yield self.store.get_profile_avatar_url(self.frank.localpart)),
|
(yield self.store.get_profile_avatar_url(self.frank.localpart)),
|
||||||
|
|
|
@ -138,9 +138,9 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
self.room_member_handler.get_joined_rooms_for_user = get_joined_rooms_for_user
|
self.room_member_handler.get_joined_rooms_for_user = get_joined_rooms_for_user
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def fetch_room_distributions_into(room_id, localusers=None,
|
def fetch_room_distributions_into(
|
||||||
remotedomains=None, ignore_user=None):
|
room_id, localusers=None, remotedomains=None, ignore_user=None
|
||||||
|
):
|
||||||
members = yield get_room_members(room_id)
|
members = yield get_room_members(room_id)
|
||||||
for member in members:
|
for member in members:
|
||||||
if ignore_user is not None and member == ignore_user:
|
if ignore_user is not None and member == ignore_user:
|
||||||
|
@ -153,7 +153,8 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
if remotedomains is not None:
|
if remotedomains is not None:
|
||||||
remotedomains.add(member.domain)
|
remotedomains.add(member.domain)
|
||||||
self.room_member_handler.fetch_room_distributions_into = (
|
self.room_member_handler.fetch_room_distributions_into = (
|
||||||
fetch_room_distributions_into)
|
fetch_room_distributions_into
|
||||||
|
)
|
||||||
|
|
||||||
def check_joined_room(room_id, user_id):
|
def check_joined_room(room_id, user_id):
|
||||||
if user_id not in [u.to_string() for u in self.room_members]:
|
if user_id not in [u.to_string() for u in self.room_members]:
|
||||||
|
@ -207,9 +208,12 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
|
|
||||||
put_json = self.mock_http_client.put_json
|
put_json = self.mock_http_client.put_json
|
||||||
put_json.expect_call_and_return(
|
put_json.expect_call_and_return(
|
||||||
call("farm",
|
call(
|
||||||
|
"farm",
|
||||||
path="/_matrix/federation/v1/send/1000000/",
|
path="/_matrix/federation/v1/send/1000000/",
|
||||||
data=_expect_edu("farm", "m.typing",
|
data=_expect_edu(
|
||||||
|
"farm",
|
||||||
|
"m.typing",
|
||||||
content={
|
content={
|
||||||
"room_id": self.room_id,
|
"room_id": self.room_id,
|
||||||
"user_id": self.u_apple.to_string(),
|
"user_id": self.u_apple.to_string(),
|
||||||
|
@ -237,9 +241,12 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
|
|
||||||
self.assertEquals(self.event_source.get_current_key(), 0)
|
self.assertEquals(self.event_source.get_current_key(), 0)
|
||||||
|
|
||||||
yield self.mock_federation_resource.trigger("PUT",
|
yield self.mock_federation_resource.trigger(
|
||||||
|
"PUT",
|
||||||
"/_matrix/federation/v1/send/1000000/",
|
"/_matrix/federation/v1/send/1000000/",
|
||||||
_make_edu_json("farm", "m.typing",
|
_make_edu_json(
|
||||||
|
"farm",
|
||||||
|
"m.typing",
|
||||||
content={
|
content={
|
||||||
"room_id": self.room_id,
|
"room_id": self.room_id,
|
||||||
"user_id": self.u_onion.to_string(),
|
"user_id": self.u_onion.to_string(),
|
||||||
|
@ -257,16 +264,13 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
room_ids=[self.room_id],
|
room_ids=[self.room_id],
|
||||||
from_key=0
|
from_key=0
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEquals(events[0], [{
|
||||||
events[0],
|
"type": "m.typing",
|
||||||
[
|
"room_id": self.room_id,
|
||||||
{"type": "m.typing",
|
"content": {
|
||||||
"room_id": self.room_id,
|
"user_ids": [self.u_onion.to_string()],
|
||||||
"content": {
|
},
|
||||||
"user_ids": [self.u_onion.to_string()],
|
}])
|
||||||
}},
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_stopped_typing(self):
|
def test_stopped_typing(self):
|
||||||
|
@ -274,9 +278,12 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
|
|
||||||
put_json = self.mock_http_client.put_json
|
put_json = self.mock_http_client.put_json
|
||||||
put_json.expect_call_and_return(
|
put_json.expect_call_and_return(
|
||||||
call("farm",
|
call(
|
||||||
|
"farm",
|
||||||
path="/_matrix/federation/v1/send/1000000/",
|
path="/_matrix/federation/v1/send/1000000/",
|
||||||
data=_expect_edu("farm", "m.typing",
|
data=_expect_edu(
|
||||||
|
"farm",
|
||||||
|
"m.typing",
|
||||||
content={
|
content={
|
||||||
"room_id": self.room_id,
|
"room_id": self.room_id,
|
||||||
"user_id": self.u_apple.to_string(),
|
"user_id": self.u_apple.to_string(),
|
||||||
|
@ -317,16 +324,13 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
room_ids=[self.room_id],
|
room_ids=[self.room_id],
|
||||||
from_key=0,
|
from_key=0,
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEquals(events[0], [{
|
||||||
events[0],
|
"type": "m.typing",
|
||||||
[
|
"room_id": self.room_id,
|
||||||
{"type": "m.typing",
|
"content": {
|
||||||
"room_id": self.room_id,
|
"user_ids": [],
|
||||||
"content": {
|
},
|
||||||
"user_ids": [],
|
}])
|
||||||
}},
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_typing_timeout(self):
|
def test_typing_timeout(self):
|
||||||
|
@ -351,16 +355,13 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
room_ids=[self.room_id],
|
room_ids=[self.room_id],
|
||||||
from_key=0,
|
from_key=0,
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEquals(events[0], [{
|
||||||
events[0],
|
"type": "m.typing",
|
||||||
[
|
"room_id": self.room_id,
|
||||||
{"type": "m.typing",
|
"content": {
|
||||||
"room_id": self.room_id,
|
"user_ids": [self.u_apple.to_string()],
|
||||||
"content": {
|
},
|
||||||
"user_ids": [self.u_apple.to_string()],
|
}])
|
||||||
}},
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
self.clock.advance_time(11)
|
self.clock.advance_time(11)
|
||||||
|
|
||||||
|
@ -373,16 +374,13 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
room_ids=[self.room_id],
|
room_ids=[self.room_id],
|
||||||
from_key=1,
|
from_key=1,
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEquals(events[0], [{
|
||||||
events[0],
|
"type": "m.typing",
|
||||||
[
|
"room_id": self.room_id,
|
||||||
{"type": "m.typing",
|
"content": {
|
||||||
"room_id": self.room_id,
|
"user_ids": [],
|
||||||
"content": {
|
},
|
||||||
"user_ids": [],
|
}])
|
||||||
}},
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
# SYN-230 - see if we can still set after timeout
|
# SYN-230 - see if we can still set after timeout
|
||||||
|
|
||||||
|
@ -403,13 +401,10 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
room_ids=[self.room_id],
|
room_ids=[self.room_id],
|
||||||
from_key=0,
|
from_key=0,
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEquals(events[0], [{
|
||||||
events[0],
|
"type": "m.typing",
|
||||||
[
|
"room_id": self.room_id,
|
||||||
{"type": "m.typing",
|
"content": {
|
||||||
"room_id": self.room_id,
|
"user_ids": [self.u_apple.to_string()],
|
||||||
"content": {
|
},
|
||||||
"user_ids": [self.u_apple.to_string()],
|
}])
|
||||||
}},
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
|
@ -12,4 +12,3 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,9 @@ class ProfileTestCase(unittest.TestCase):
|
||||||
mocked_get = self.mock_handler.get_displayname
|
mocked_get = self.mock_handler.get_displayname
|
||||||
mocked_get.return_value = defer.succeed("Frank")
|
mocked_get.return_value = defer.succeed("Frank")
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("GET",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"/profile/%s/displayname" % (myid), None)
|
"GET", "/profile/%s/displayname" % (myid), None
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
self.assertEquals({"displayname": "Frank"}, response)
|
self.assertEquals({"displayname": "Frank"}, response)
|
||||||
|
@ -77,9 +78,11 @@ class ProfileTestCase(unittest.TestCase):
|
||||||
mocked_set = self.mock_handler.set_displayname
|
mocked_set = self.mock_handler.set_displayname
|
||||||
mocked_set.return_value = defer.succeed(())
|
mocked_set.return_value = defer.succeed(())
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"/profile/%s/displayname" % (myid),
|
"PUT",
|
||||||
'{"displayname": "Frank Jr."}')
|
"/profile/%s/displayname" % (myid),
|
||||||
|
'{"displayname": "Frank Jr."}'
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
self.assertEquals(mocked_set.call_args[0][0].localpart, "1234ABCD")
|
self.assertEquals(mocked_set.call_args[0][0].localpart, "1234ABCD")
|
||||||
|
@ -91,19 +94,23 @@ class ProfileTestCase(unittest.TestCase):
|
||||||
mocked_set = self.mock_handler.set_displayname
|
mocked_set = self.mock_handler.set_displayname
|
||||||
mocked_set.side_effect = AuthError(400, "message")
|
mocked_set.side_effect = AuthError(400, "message")
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"/profile/%s/displayname" % ("@4567:test"), '"Frank Jr."')
|
"PUT", "/profile/%s/displayname" % ("@4567:test"), '"Frank Jr."'
|
||||||
|
)
|
||||||
|
|
||||||
self.assertTrue(400 <= code < 499,
|
self.assertTrue(
|
||||||
msg="code %d is in the 4xx range" % (code))
|
400 <= code < 499,
|
||||||
|
msg="code %d is in the 4xx range" % (code)
|
||||||
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_other_name(self):
|
def test_get_other_name(self):
|
||||||
mocked_get = self.mock_handler.get_displayname
|
mocked_get = self.mock_handler.get_displayname
|
||||||
mocked_get.return_value = defer.succeed("Bob")
|
mocked_get.return_value = defer.succeed("Bob")
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("GET",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"/profile/%s/displayname" % ("@opaque:elsewhere"), None)
|
"GET", "/profile/%s/displayname" % ("@opaque:elsewhere"), None
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
self.assertEquals({"displayname": "Bob"}, response)
|
self.assertEquals({"displayname": "Bob"}, response)
|
||||||
|
@ -113,19 +120,23 @@ class ProfileTestCase(unittest.TestCase):
|
||||||
mocked_set = self.mock_handler.set_displayname
|
mocked_set = self.mock_handler.set_displayname
|
||||||
mocked_set.side_effect = SynapseError(400, "message")
|
mocked_set.side_effect = SynapseError(400, "message")
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"/profile/%s/displayname" % ("@opaque:elsewhere"), None)
|
"PUT", "/profile/%s/displayname" % ("@opaque:elsewhere"), None
|
||||||
|
)
|
||||||
|
|
||||||
self.assertTrue(400 <= code <= 499,
|
self.assertTrue(
|
||||||
msg="code %d is in the 4xx range" % (code))
|
400 <= code <= 499,
|
||||||
|
msg="code %d is in the 4xx range" % (code)
|
||||||
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_my_avatar(self):
|
def test_get_my_avatar(self):
|
||||||
mocked_get = self.mock_handler.get_avatar_url
|
mocked_get = self.mock_handler.get_avatar_url
|
||||||
mocked_get.return_value = defer.succeed("http://my.server/me.png")
|
mocked_get.return_value = defer.succeed("http://my.server/me.png")
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("GET",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"/profile/%s/avatar_url" % (myid), None)
|
"GET", "/profile/%s/avatar_url" % (myid), None
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
self.assertEquals({"avatar_url": "http://my.server/me.png"}, response)
|
self.assertEquals({"avatar_url": "http://my.server/me.png"}, response)
|
||||||
|
@ -136,12 +147,13 @@ class ProfileTestCase(unittest.TestCase):
|
||||||
mocked_set = self.mock_handler.set_avatar_url
|
mocked_set = self.mock_handler.set_avatar_url
|
||||||
mocked_set.return_value = defer.succeed(())
|
mocked_set.return_value = defer.succeed(())
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"/profile/%s/avatar_url" % (myid),
|
"PUT",
|
||||||
'{"avatar_url": "http://my.server/pic.gif"}')
|
"/profile/%s/avatar_url" % (myid),
|
||||||
|
'{"avatar_url": "http://my.server/pic.gif"}'
|
||||||
|
)
|
||||||
|
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
self.assertEquals(mocked_set.call_args[0][0].localpart, "1234ABCD")
|
self.assertEquals(mocked_set.call_args[0][0].localpart, "1234ABCD")
|
||||||
self.assertEquals(mocked_set.call_args[0][1].localpart, "1234ABCD")
|
self.assertEquals(mocked_set.call_args[0][1].localpart, "1234ABCD")
|
||||||
self.assertEquals(mocked_set.call_args[0][2],
|
self.assertEquals(mocked_set.call_args[0][2], "http://my.server/pic.gif")
|
||||||
"http://my.server/pic.gif")
|
|
||||||
|
|
|
@ -82,19 +82,22 @@ class RoomPermissionsTestCase(RestTestCase):
|
||||||
is_public=True)
|
is_public=True)
|
||||||
|
|
||||||
# send a message in one of the rooms
|
# send a message in one of the rooms
|
||||||
self.created_rmid_msg_path = ("/rooms/%s/send/m.room.message/a1" %
|
self.created_rmid_msg_path = (
|
||||||
(self.created_rmid))
|
"/rooms/%s/send/m.room.message/a1" % (self.created_rmid)
|
||||||
|
)
|
||||||
(code, response) = yield self.mock_resource.trigger(
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"PUT",
|
"PUT",
|
||||||
self.created_rmid_msg_path,
|
self.created_rmid_msg_path,
|
||||||
'{"msgtype":"m.text","body":"test msg"}')
|
'{"msgtype":"m.text","body":"test msg"}'
|
||||||
|
)
|
||||||
self.assertEquals(200, code, msg=str(response))
|
self.assertEquals(200, code, msg=str(response))
|
||||||
|
|
||||||
# set topic for public room
|
# set topic for public room
|
||||||
(code, response) = yield self.mock_resource.trigger(
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"PUT",
|
"PUT",
|
||||||
"/rooms/%s/state/m.room.topic" % self.created_public_rmid,
|
"/rooms/%s/state/m.room.topic" % self.created_public_rmid,
|
||||||
'{"topic":"Public Room Topic"}')
|
'{"topic":"Public Room Topic"}'
|
||||||
|
)
|
||||||
self.assertEquals(200, code, msg=str(response))
|
self.assertEquals(200, code, msg=str(response))
|
||||||
|
|
||||||
# auth as user_id now
|
# auth as user_id now
|
||||||
|
@ -103,37 +106,6 @@ class RoomPermissionsTestCase(RestTestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# @defer.inlineCallbacks
|
|
||||||
# def test_get_message(self):
|
|
||||||
# # get message in uncreated room, expect 403
|
|
||||||
# (code, response) = yield self.mock_resource.trigger_get(
|
|
||||||
# "/rooms/noroom/messages/someid/m1")
|
|
||||||
# self.assertEquals(403, code, msg=str(response))
|
|
||||||
#
|
|
||||||
# # get message in created room not joined (no state), expect 403
|
|
||||||
# (code, response) = yield self.mock_resource.trigger_get(
|
|
||||||
# self.created_rmid_msg_path)
|
|
||||||
# self.assertEquals(403, code, msg=str(response))
|
|
||||||
#
|
|
||||||
# # get message in created room and invited, expect 403
|
|
||||||
# yield self.invite(room=self.created_rmid, src=self.rmcreator_id,
|
|
||||||
# targ=self.user_id)
|
|
||||||
# (code, response) = yield self.mock_resource.trigger_get(
|
|
||||||
# self.created_rmid_msg_path)
|
|
||||||
# self.assertEquals(403, code, msg=str(response))
|
|
||||||
#
|
|
||||||
# # get message in created room and joined, expect 200
|
|
||||||
# yield self.join(room=self.created_rmid, user=self.user_id)
|
|
||||||
# (code, response) = yield self.mock_resource.trigger_get(
|
|
||||||
# self.created_rmid_msg_path)
|
|
||||||
# self.assertEquals(200, code, msg=str(response))
|
|
||||||
#
|
|
||||||
# # get message in created room and left, expect 403
|
|
||||||
# yield self.leave(room=self.created_rmid, user=self.user_id)
|
|
||||||
# (code, response) = yield self.mock_resource.trigger_get(
|
|
||||||
# self.created_rmid_msg_path)
|
|
||||||
# self.assertEquals(403, code, msg=str(response))
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_send_message(self):
|
def test_send_message(self):
|
||||||
msg_content = '{"msgtype":"m.text","body":"hello"}'
|
msg_content = '{"msgtype":"m.text","body":"hello"}'
|
||||||
|
@ -195,25 +167,30 @@ class RoomPermissionsTestCase(RestTestCase):
|
||||||
|
|
||||||
# set/get topic in uncreated room, expect 403
|
# set/get topic in uncreated room, expect 403
|
||||||
(code, response) = yield self.mock_resource.trigger(
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"PUT", "/rooms/%s/state/m.room.topic" % self.uncreated_rmid,
|
"PUT", "/rooms/%s/state/m.room.topic" % self.uncreated_rmid,
|
||||||
topic_content)
|
topic_content
|
||||||
|
)
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
(code, response) = yield self.mock_resource.trigger_get(
|
(code, response) = yield self.mock_resource.trigger_get(
|
||||||
"/rooms/%s/state/m.room.topic" % self.uncreated_rmid)
|
"/rooms/%s/state/m.room.topic" % self.uncreated_rmid
|
||||||
|
)
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
|
|
||||||
# set/get topic in created PRIVATE room not joined, expect 403
|
# set/get topic in created PRIVATE room not joined, expect 403
|
||||||
(code, response) = yield self.mock_resource.trigger(
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"PUT", topic_path, topic_content)
|
"PUT", topic_path, topic_content
|
||||||
|
)
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
(code, response) = yield self.mock_resource.trigger_get(topic_path)
|
(code, response) = yield self.mock_resource.trigger_get(topic_path)
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
|
|
||||||
# set topic in created PRIVATE room and invited, expect 403
|
# set topic in created PRIVATE room and invited, expect 403
|
||||||
yield self.invite(room=self.created_rmid, src=self.rmcreator_id,
|
yield self.invite(
|
||||||
targ=self.user_id)
|
room=self.created_rmid, src=self.rmcreator_id, targ=self.user_id
|
||||||
|
)
|
||||||
(code, response) = yield self.mock_resource.trigger(
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"PUT", topic_path, topic_content)
|
"PUT", topic_path, topic_content
|
||||||
|
)
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
|
|
||||||
# get topic in created PRIVATE room and invited, expect 403
|
# get topic in created PRIVATE room and invited, expect 403
|
||||||
|
@ -226,7 +203,8 @@ class RoomPermissionsTestCase(RestTestCase):
|
||||||
# Only room ops can set topic by default
|
# Only room ops can set topic by default
|
||||||
self.auth_user_id = self.rmcreator_id
|
self.auth_user_id = self.rmcreator_id
|
||||||
(code, response) = yield self.mock_resource.trigger(
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"PUT", topic_path, topic_content)
|
"PUT", topic_path, topic_content
|
||||||
|
)
|
||||||
self.assertEquals(200, code, msg=str(response))
|
self.assertEquals(200, code, msg=str(response))
|
||||||
self.auth_user_id = self.user_id
|
self.auth_user_id = self.user_id
|
||||||
|
|
||||||
|
@ -237,30 +215,31 @@ class RoomPermissionsTestCase(RestTestCase):
|
||||||
# set/get topic in created PRIVATE room and left, expect 403
|
# set/get topic in created PRIVATE room and left, expect 403
|
||||||
yield self.leave(room=self.created_rmid, user=self.user_id)
|
yield self.leave(room=self.created_rmid, user=self.user_id)
|
||||||
(code, response) = yield self.mock_resource.trigger(
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"PUT", topic_path, topic_content)
|
"PUT", topic_path, topic_content
|
||||||
|
)
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
(code, response) = yield self.mock_resource.trigger_get(topic_path)
|
(code, response) = yield self.mock_resource.trigger_get(topic_path)
|
||||||
self.assertEquals(200, code, msg=str(response))
|
self.assertEquals(200, code, msg=str(response))
|
||||||
|
|
||||||
# get topic in PUBLIC room, not joined, expect 403
|
# get topic in PUBLIC room, not joined, expect 403
|
||||||
(code, response) = yield self.mock_resource.trigger_get(
|
(code, response) = yield self.mock_resource.trigger_get(
|
||||||
"/rooms/%s/state/m.room.topic" % self.created_public_rmid)
|
"/rooms/%s/state/m.room.topic" % self.created_public_rmid
|
||||||
|
)
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
|
|
||||||
# set topic in PUBLIC room, not joined, expect 403
|
# set topic in PUBLIC room, not joined, expect 403
|
||||||
(code, response) = yield self.mock_resource.trigger(
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"PUT",
|
"PUT",
|
||||||
"/rooms/%s/state/m.room.topic" % self.created_public_rmid,
|
"/rooms/%s/state/m.room.topic" % self.created_public_rmid,
|
||||||
topic_content)
|
topic_content
|
||||||
|
)
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _test_get_membership(self, room=None, members=[], expect_code=None):
|
def _test_get_membership(self, room=None, members=[], expect_code=None):
|
||||||
path = "/rooms/%s/state/m.room.member/%s"
|
|
||||||
for member in members:
|
for member in members:
|
||||||
(code, response) = yield self.mock_resource.trigger_get(
|
path = "/rooms/%s/state/m.room.member/%s" % (room, member)
|
||||||
path %
|
(code, response) = yield self.mock_resource.trigger_get(path)
|
||||||
(room, member))
|
|
||||||
self.assertEquals(expect_code, code)
|
self.assertEquals(expect_code, code)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -461,20 +440,23 @@ class RoomsMemberListTestCase(RestTestCase):
|
||||||
def test_get_member_list(self):
|
def test_get_member_list(self):
|
||||||
room_id = yield self.create_room_as(self.user_id)
|
room_id = yield self.create_room_as(self.user_id)
|
||||||
(code, response) = yield self.mock_resource.trigger_get(
|
(code, response) = yield self.mock_resource.trigger_get(
|
||||||
"/rooms/%s/members" % room_id)
|
"/rooms/%s/members" % room_id
|
||||||
|
)
|
||||||
self.assertEquals(200, code, msg=str(response))
|
self.assertEquals(200, code, msg=str(response))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_member_list_no_room(self):
|
def test_get_member_list_no_room(self):
|
||||||
(code, response) = yield self.mock_resource.trigger_get(
|
(code, response) = yield self.mock_resource.trigger_get(
|
||||||
"/rooms/roomdoesnotexist/members")
|
"/rooms/roomdoesnotexist/members"
|
||||||
|
)
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_member_list_no_permission(self):
|
def test_get_member_list_no_permission(self):
|
||||||
room_id = yield self.create_room_as("@some_other_guy:red")
|
room_id = yield self.create_room_as("@some_other_guy:red")
|
||||||
(code, response) = yield self.mock_resource.trigger_get(
|
(code, response) = yield self.mock_resource.trigger_get(
|
||||||
"/rooms/%s/members" % room_id)
|
"/rooms/%s/members" % room_id
|
||||||
|
)
|
||||||
self.assertEquals(403, code, msg=str(response))
|
self.assertEquals(403, code, msg=str(response))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -636,34 +618,41 @@ class RoomTopicTestCase(RestTestCase):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_invalid_puts(self):
|
def test_invalid_puts(self):
|
||||||
# missing keys or invalid json
|
# missing keys or invalid json
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
self.path, '{}')
|
"PUT", self.path, '{}'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
self.path, '{"_name":"bob"}')
|
"PUT", self.path, '{"_name":"bob"}'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
self.path, '{"nao')
|
"PUT", self.path, '{"nao'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
self.path, '[{"_name":"bob"},{"_name":"jill"}]')
|
"PUT", self.path, '[{"_name":"bob"},{"_name":"jill"}]'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
self.path, 'text only')
|
"PUT", self.path, 'text only'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
self.path, '')
|
"PUT", self.path, ''
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
# valid key, wrong type
|
# valid key, wrong type
|
||||||
content = '{"topic":["Topic name"]}'
|
content = '{"topic":["Topic name"]}'
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
self.path, content)
|
"PUT", self.path, content
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -674,8 +663,9 @@ class RoomTopicTestCase(RestTestCase):
|
||||||
|
|
||||||
# valid put
|
# valid put
|
||||||
content = '{"topic":"Topic name"}'
|
content = '{"topic":"Topic name"}'
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
self.path, content)
|
"PUT", self.path, content
|
||||||
|
)
|
||||||
self.assertEquals(200, code, msg=str(response))
|
self.assertEquals(200, code, msg=str(response))
|
||||||
|
|
||||||
# valid get
|
# valid get
|
||||||
|
@ -687,8 +677,9 @@ class RoomTopicTestCase(RestTestCase):
|
||||||
def test_rooms_topic_with_extra_keys(self):
|
def test_rooms_topic_with_extra_keys(self):
|
||||||
# valid put with extra keys
|
# valid put with extra keys
|
||||||
content = '{"topic":"Seasons","subtopic":"Summer"}'
|
content = '{"topic":"Seasons","subtopic":"Summer"}'
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
self.path, content)
|
"PUT", self.path, content
|
||||||
|
)
|
||||||
self.assertEquals(200, code, msg=str(response))
|
self.assertEquals(200, code, msg=str(response))
|
||||||
|
|
||||||
# valid get
|
# valid get
|
||||||
|
@ -740,33 +731,38 @@ class RoomMemberStateTestCase(RestTestCase):
|
||||||
def test_invalid_puts(self):
|
def test_invalid_puts(self):
|
||||||
path = "/rooms/%s/state/m.room.member/%s" % (self.room_id, self.user_id)
|
path = "/rooms/%s/state/m.room.member/%s" % (self.room_id, self.user_id)
|
||||||
# missing keys or invalid json
|
# missing keys or invalid json
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger("PUT", path, '{}')
|
||||||
path, '{}')
|
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, '{"_name":"bob"}')
|
"PUT", path, '{"_name":"bob"}'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, '{"nao')
|
"PUT", path, '{"nao'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, '[{"_name":"bob"},{"_name":"jill"}]')
|
"PUT", path, '[{"_name":"bob"},{"_name":"jill"}]'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, 'text only')
|
"PUT", path, 'text only'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, '')
|
"PUT", path, ''
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
# valid keys, wrong types
|
# valid keys, wrong types
|
||||||
content = ('{"membership":["%s","%s","%s"]}' %
|
content = ('{"membership":["%s","%s","%s"]}' % (
|
||||||
(Membership.INVITE, Membership.JOIN, Membership.LEAVE))
|
Membership.INVITE, Membership.JOIN, Membership.LEAVE
|
||||||
|
))
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT", path, content)
|
(code, response) = yield self.mock_resource.trigger("PUT", path, content)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
|
@ -813,8 +809,9 @@ class RoomMemberStateTestCase(RestTestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
# valid invite message with custom key
|
# valid invite message with custom key
|
||||||
content = ('{"membership":"%s","invite_text":"%s"}' %
|
content = ('{"membership":"%s","invite_text":"%s"}' % (
|
||||||
(Membership.INVITE, "Join us!"))
|
Membership.INVITE, "Join us!"
|
||||||
|
))
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT", path, content)
|
(code, response) = yield self.mock_resource.trigger("PUT", path, content)
|
||||||
self.assertEquals(200, code, msg=str(response))
|
self.assertEquals(200, code, msg=str(response))
|
||||||
|
|
||||||
|
@ -867,28 +864,34 @@ class RoomMessagesTestCase(RestTestCase):
|
||||||
path = "/rooms/%s/send/m.room.message/mid1" % (
|
path = "/rooms/%s/send/m.room.message/mid1" % (
|
||||||
urllib.quote(self.room_id))
|
urllib.quote(self.room_id))
|
||||||
# missing keys or invalid json
|
# missing keys or invalid json
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, '{}')
|
"PUT", path, '{}'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, '{"_name":"bob"}')
|
"PUT", path, '{"_name":"bob"}'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, '{"nao')
|
"PUT", path, '{"nao'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, '[{"_name":"bob"},{"_name":"jill"}]')
|
"PUT", path, '[{"_name":"bob"},{"_name":"jill"}]'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, 'text only')
|
"PUT", path, 'text only'
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
path, '')
|
"PUT", path, ''
|
||||||
|
)
|
||||||
self.assertEquals(400, code, msg=str(response))
|
self.assertEquals(400, code, msg=str(response))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -959,7 +962,8 @@ class RoomInitialSyncTestCase(RestTestCase):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_initial_sync(self):
|
def test_initial_sync(self):
|
||||||
(code, response) = yield self.mock_resource.trigger_get(
|
(code, response) = yield self.mock_resource.trigger_get(
|
||||||
"/rooms/%s/initialSync" % self.room_id)
|
"/rooms/%s/initialSync" % self.room_id
|
||||||
|
)
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
|
|
||||||
self.assertEquals(self.room_id, response["room_id"])
|
self.assertEquals(self.room_id, response["room_id"])
|
||||||
|
@ -983,8 +987,8 @@ class RoomInitialSyncTestCase(RestTestCase):
|
||||||
|
|
||||||
self.assertTrue("presence" in response)
|
self.assertTrue("presence" in response)
|
||||||
|
|
||||||
presence_by_user = {e["content"]["user_id"]: e
|
presence_by_user = {
|
||||||
for e in response["presence"]
|
e["content"]["user_id"]: e for e in response["presence"]
|
||||||
}
|
}
|
||||||
self.assertTrue(self.user_id in presence_by_user)
|
self.assertTrue(self.user_id in presence_by_user)
|
||||||
self.assertEquals("m.presence", presence_by_user[self.user_id]["type"])
|
self.assertEquals("m.presence", presence_by_user[self.user_id]["type"])
|
||||||
|
|
|
@ -81,9 +81,9 @@ class RoomTypingTestCase(RestTestCase):
|
||||||
return defer.succeed([])
|
return defer.succeed([])
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def fetch_room_distributions_into(room_id, localusers=None,
|
def fetch_room_distributions_into(
|
||||||
remotedomains=None, ignore_user=None):
|
room_id, localusers=None, remotedomains=None, ignore_user=None
|
||||||
|
):
|
||||||
members = yield get_room_members(room_id)
|
members = yield get_room_members(room_id)
|
||||||
for member in members:
|
for member in members:
|
||||||
if ignore_user is not None and member == ignore_user:
|
if ignore_user is not None and member == ignore_user:
|
||||||
|
@ -96,7 +96,8 @@ class RoomTypingTestCase(RestTestCase):
|
||||||
if remotedomains is not None:
|
if remotedomains is not None:
|
||||||
remotedomains.add(member.domain)
|
remotedomains.add(member.domain)
|
||||||
hs.get_handlers().room_member_handler.fetch_room_distributions_into = (
|
hs.get_handlers().room_member_handler.fetch_room_distributions_into = (
|
||||||
fetch_room_distributions_into)
|
fetch_room_distributions_into
|
||||||
|
)
|
||||||
|
|
||||||
synapse.rest.client.v1.room.register_servlets(hs, self.mock_resource)
|
synapse.rest.client.v1.room.register_servlets(hs, self.mock_resource)
|
||||||
|
|
||||||
|
@ -109,8 +110,8 @@ class RoomTypingTestCase(RestTestCase):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_set_typing(self):
|
def test_set_typing(self):
|
||||||
(code, _) = yield self.mock_resource.trigger("PUT",
|
(code, _) = yield self.mock_resource.trigger(
|
||||||
"/rooms/%s/typing/%s" % (self.room_id, self.user_id),
|
"PUT", "/rooms/%s/typing/%s" % (self.room_id, self.user_id),
|
||||||
'{"typing": true, "timeout": 30000}'
|
'{"typing": true, "timeout": 30000}'
|
||||||
)
|
)
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
|
@ -120,41 +121,38 @@ class RoomTypingTestCase(RestTestCase):
|
||||||
from_key=0,
|
from_key=0,
|
||||||
room_ids=[self.room_id],
|
room_ids=[self.room_id],
|
||||||
)
|
)
|
||||||
self.assertEquals(
|
self.assertEquals(events[0], [{
|
||||||
events[0],
|
"type": "m.typing",
|
||||||
[
|
"room_id": self.room_id,
|
||||||
{"type": "m.typing",
|
"content": {
|
||||||
"room_id": self.room_id,
|
"user_ids": [self.user_id],
|
||||||
"content": {
|
}
|
||||||
"user_ids": [self.user_id],
|
}])
|
||||||
}},
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_set_not_typing(self):
|
def test_set_not_typing(self):
|
||||||
(code, _) = yield self.mock_resource.trigger("PUT",
|
(code, _) = yield self.mock_resource.trigger(
|
||||||
"/rooms/%s/typing/%s" % (self.room_id, self.user_id),
|
"PUT", "/rooms/%s/typing/%s" % (self.room_id, self.user_id),
|
||||||
'{"typing": false}'
|
'{"typing": false}'
|
||||||
)
|
)
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_typing_timeout(self):
|
def test_typing_timeout(self):
|
||||||
(code, _) = yield self.mock_resource.trigger("PUT",
|
(code, _) = yield self.mock_resource.trigger(
|
||||||
"/rooms/%s/typing/%s" % (self.room_id, self.user_id),
|
"PUT", "/rooms/%s/typing/%s" % (self.room_id, self.user_id),
|
||||||
'{"typing": true, "timeout": 30000}'
|
'{"typing": true, "timeout": 30000}'
|
||||||
)
|
)
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
|
|
||||||
self.assertEquals(self.event_source.get_current_key(), 1)
|
self.assertEquals(self.event_source.get_current_key(), 1)
|
||||||
|
|
||||||
self.clock.advance_time(31);
|
self.clock.advance_time(31)
|
||||||
|
|
||||||
self.assertEquals(self.event_source.get_current_key(), 2)
|
self.assertEquals(self.event_source.get_current_key(), 2)
|
||||||
|
|
||||||
(code, _) = yield self.mock_resource.trigger("PUT",
|
(code, _) = yield self.mock_resource.trigger(
|
||||||
"/rooms/%s/typing/%s" % (self.room_id, self.user_id),
|
"PUT", "/rooms/%s/typing/%s" % (self.room_id, self.user_id),
|
||||||
'{"typing": true, "timeout": 30000}'
|
'{"typing": true, "timeout": 30000}'
|
||||||
)
|
)
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
|
|
|
@ -84,8 +84,9 @@ class RestTestCase(unittest.TestCase):
|
||||||
"membership": membership
|
"membership": membership
|
||||||
}
|
}
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("PUT", path,
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
json.dumps(data))
|
"PUT", path, json.dumps(data)
|
||||||
|
)
|
||||||
self.assertEquals(expect_code, code, msg=str(response))
|
self.assertEquals(expect_code, code, msg=str(response))
|
||||||
|
|
||||||
self.auth_user_id = temp_id
|
self.auth_user_id = temp_id
|
||||||
|
|
|
@ -55,7 +55,7 @@ class V2AlphaRestTestCase(unittest.TestCase):
|
||||||
r.register_servlets(hs, self.mock_resource)
|
r.register_servlets(hs, self.mock_resource)
|
||||||
|
|
||||||
def make_datastore_mock(self):
|
def make_datastore_mock(self):
|
||||||
store = Mock(spec=[
|
store = Mock(spec=[
|
||||||
"insert_client_ip",
|
"insert_client_ip",
|
||||||
])
|
])
|
||||||
store.get_app_service_by_token = Mock(return_value=None)
|
store.get_app_service_by_token = Mock(return_value=None)
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from mock import Mock
|
|
||||||
|
|
||||||
from . import V2AlphaRestTestCase
|
from . import V2AlphaRestTestCase
|
||||||
|
|
||||||
from synapse.rest.client.v2_alpha import filter
|
from synapse.rest.client.v2_alpha import filter
|
||||||
|
@ -53,9 +51,8 @@ class FilterTestCase(V2AlphaRestTestCase):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_add_filter(self):
|
def test_add_filter(self):
|
||||||
(code, response) = yield self.mock_resource.trigger("POST",
|
(code, response) = yield self.mock_resource.trigger(
|
||||||
"/user/%s/filter" % (self.USER_ID),
|
"POST", "/user/%s/filter" % (self.USER_ID), '{"type": ["m.*"]}'
|
||||||
'{"type": ["m.*"]}'
|
|
||||||
)
|
)
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
self.assertEquals({"filter_id": "0"}, response)
|
self.assertEquals({"filter_id": "0"}, response)
|
||||||
|
@ -70,8 +67,8 @@ class FilterTestCase(V2AlphaRestTestCase):
|
||||||
{"type": ["m.*"]}
|
{"type": ["m.*"]}
|
||||||
]
|
]
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("GET",
|
(code, response) = yield self.mock_resource.trigger_get(
|
||||||
"/user/%s/filter/0" % (self.USER_ID), None
|
"/user/%s/filter/0" % (self.USER_ID)
|
||||||
)
|
)
|
||||||
self.assertEquals(200, code)
|
self.assertEquals(200, code)
|
||||||
self.assertEquals({"type": ["m.*"]}, response)
|
self.assertEquals({"type": ["m.*"]}, response)
|
||||||
|
@ -82,14 +79,14 @@ class FilterTestCase(V2AlphaRestTestCase):
|
||||||
{"type": ["m.*"]}
|
{"type": ["m.*"]}
|
||||||
]
|
]
|
||||||
|
|
||||||
(code, response) = yield self.mock_resource.trigger("GET",
|
(code, response) = yield self.mock_resource.trigger_get(
|
||||||
"/user/%s/filter/2" % (self.USER_ID), None
|
"/user/%s/filter/2" % (self.USER_ID)
|
||||||
)
|
)
|
||||||
self.assertEquals(404, code)
|
self.assertEquals(404, code)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_filter_no_user(self):
|
def test_get_filter_no_user(self):
|
||||||
(code, response) = yield self.mock_resource.trigger("GET",
|
(code, response) = yield self.mock_resource.trigger_get(
|
||||||
"/user/%s/filter/0" % (self.USER_ID), None
|
"/user/%s/filter/0" % (self.USER_ID)
|
||||||
)
|
)
|
||||||
self.assertEquals(404, code)
|
self.assertEquals(404, code)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from synapse.rest.client.v2_alpha.register import RegisterRestServlet
|
from synapse.rest.client.v2_alpha.register import RegisterRestServlet
|
||||||
from synapse.api.errors import SynapseError
|
from synapse.api.errors import SynapseError
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
from mock import Mock, MagicMock
|
from mock import Mock
|
||||||
from tests import unittest
|
from tests import unittest
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class RegisterRestServletTestCase(unittest.TestCase):
|
||||||
|
|
||||||
self.auth_result = (False, None, None)
|
self.auth_result = (False, None, None)
|
||||||
self.auth_handler = Mock(
|
self.auth_handler = Mock(
|
||||||
check_auth=Mock(side_effect=lambda x,y,z: self.auth_result)
|
check_auth=Mock(side_effect=lambda x, y, z: self.auth_result)
|
||||||
)
|
)
|
||||||
self.registration_handler = Mock()
|
self.registration_handler = Mock()
|
||||||
self.identity_handler = Mock()
|
self.identity_handler = Mock()
|
||||||
|
|
|
@ -14,15 +14,9 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
from tests import unittest
|
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from synapse.api.constants import EventTypes, Membership
|
from synapse.api.constants import EventTypes
|
||||||
from synapse.types import UserID, RoomID
|
|
||||||
|
|
||||||
from tests.utils import setup_test_homeserver
|
|
||||||
|
|
||||||
from mock import Mock
|
|
||||||
|
|
||||||
|
|
||||||
class EventInjector:
|
class EventInjector:
|
||||||
|
|
|
@ -174,11 +174,13 @@ class CacheDecoratorTestCase(unittest.TestCase):
|
||||||
|
|
||||||
# There must have been at least 2 evictions, meaning if we calculate
|
# There must have been at least 2 evictions, meaning if we calculate
|
||||||
# all 12 values again, we must get called at least 2 more times
|
# all 12 values again, we must get called at least 2 more times
|
||||||
for k in range(0,12):
|
for k in range(0, 12):
|
||||||
yield a.func(k)
|
yield a.func(k)
|
||||||
|
|
||||||
self.assertTrue(callcount[0] >= 14,
|
self.assertTrue(
|
||||||
msg="Expected callcount >= 14, got %d" % (callcount[0]))
|
callcount[0] >= 14,
|
||||||
|
msg="Expected callcount >= 14, got %d" % (callcount[0])
|
||||||
|
)
|
||||||
|
|
||||||
def test_prefill(self):
|
def test_prefill(self):
|
||||||
callcount = [0]
|
callcount = [0]
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
from tests import unittest
|
from tests import unittest
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from synapse.api.constants import EventTypes
|
|
||||||
from synapse.types import UserID, RoomID, RoomAlias
|
|
||||||
|
|
||||||
from tests.utils import setup_test_homeserver
|
from tests.utils import setup_test_homeserver
|
||||||
|
|
||||||
from mock import Mock
|
from mock import Mock
|
||||||
|
|
||||||
|
|
||||||
class BackgroundUpdateTestCase(unittest.TestCase):
|
class BackgroundUpdateTestCase(unittest.TestCase):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -24,8 +22,8 @@ class BackgroundUpdateTestCase(unittest.TestCase):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_do_background_update(self):
|
def test_do_background_update(self):
|
||||||
desired_count = 1000;
|
desired_count = 1000
|
||||||
duration_ms = 42;
|
duration_ms = 42
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def update(progress, count):
|
def update(progress, count):
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
from tests import unittest
|
from tests import unittest
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
|
|
||||||
from mock import Mock, call
|
from mock import Mock
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
@ -62,13 +62,12 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
||||||
self.mock_txn.rowcount = 1
|
self.mock_txn.rowcount = 1
|
||||||
|
|
||||||
yield self.datastore._simple_insert(
|
yield self.datastore._simple_insert(
|
||||||
table="tablename",
|
table="tablename",
|
||||||
values={"columname": "Value"}
|
values={"columname": "Value"}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.mock_txn.execute.assert_called_with(
|
self.mock_txn.execute.assert_called_with(
|
||||||
"INSERT INTO tablename (columname) VALUES(?)",
|
"INSERT INTO tablename (columname) VALUES(?)", ("Value",)
|
||||||
("Value",)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -76,14 +75,14 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
||||||
self.mock_txn.rowcount = 1
|
self.mock_txn.rowcount = 1
|
||||||
|
|
||||||
yield self.datastore._simple_insert(
|
yield self.datastore._simple_insert(
|
||||||
table="tablename",
|
table="tablename",
|
||||||
# Use OrderedDict() so we can assert on the SQL generated
|
# Use OrderedDict() so we can assert on the SQL generated
|
||||||
values=OrderedDict([("colA", 1), ("colB", 2), ("colC", 3)])
|
values=OrderedDict([("colA", 1), ("colB", 2), ("colC", 3)])
|
||||||
)
|
)
|
||||||
|
|
||||||
self.mock_txn.execute.assert_called_with(
|
self.mock_txn.execute.assert_called_with(
|
||||||
"INSERT INTO tablename (colA, colB, colC) VALUES(?, ?, ?)",
|
"INSERT INTO tablename (colA, colB, colC) VALUES(?, ?, ?)",
|
||||||
(1, 2, 3,)
|
(1, 2, 3,)
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -92,15 +91,14 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
||||||
self.mock_txn.fetchall.return_value = [("Value",)]
|
self.mock_txn.fetchall.return_value = [("Value",)]
|
||||||
|
|
||||||
value = yield self.datastore._simple_select_one_onecol(
|
value = yield self.datastore._simple_select_one_onecol(
|
||||||
table="tablename",
|
table="tablename",
|
||||||
keyvalues={"keycol": "TheKey"},
|
keyvalues={"keycol": "TheKey"},
|
||||||
retcol="retcol"
|
retcol="retcol"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEquals("Value", value)
|
self.assertEquals("Value", value)
|
||||||
self.mock_txn.execute.assert_called_with(
|
self.mock_txn.execute.assert_called_with(
|
||||||
"SELECT retcol FROM tablename WHERE keycol = ?",
|
"SELECT retcol FROM tablename WHERE keycol = ?", ["TheKey"]
|
||||||
["TheKey"]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -109,15 +107,15 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
||||||
self.mock_txn.fetchone.return_value = (1, 2, 3)
|
self.mock_txn.fetchone.return_value = (1, 2, 3)
|
||||||
|
|
||||||
ret = yield self.datastore._simple_select_one(
|
ret = yield self.datastore._simple_select_one(
|
||||||
table="tablename",
|
table="tablename",
|
||||||
keyvalues={"keycol": "TheKey"},
|
keyvalues={"keycol": "TheKey"},
|
||||||
retcols=["colA", "colB", "colC"]
|
retcols=["colA", "colB", "colC"]
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEquals({"colA": 1, "colB": 2, "colC": 3}, ret)
|
self.assertEquals({"colA": 1, "colB": 2, "colC": 3}, ret)
|
||||||
self.mock_txn.execute.assert_called_with(
|
self.mock_txn.execute.assert_called_with(
|
||||||
"SELECT colA, colB, colC FROM tablename WHERE keycol = ?",
|
"SELECT colA, colB, colC FROM tablename WHERE keycol = ?",
|
||||||
["TheKey"]
|
["TheKey"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -126,32 +124,32 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
||||||
self.mock_txn.fetchone.return_value = None
|
self.mock_txn.fetchone.return_value = None
|
||||||
|
|
||||||
ret = yield self.datastore._simple_select_one(
|
ret = yield self.datastore._simple_select_one(
|
||||||
table="tablename",
|
table="tablename",
|
||||||
keyvalues={"keycol": "Not here"},
|
keyvalues={"keycol": "Not here"},
|
||||||
retcols=["colA"],
|
retcols=["colA"],
|
||||||
allow_none=True
|
allow_none=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertFalse(ret)
|
self.assertFalse(ret)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_select_list(self):
|
def test_select_list(self):
|
||||||
self.mock_txn.rowcount = 3;
|
self.mock_txn.rowcount = 3
|
||||||
self.mock_txn.fetchall.return_value = ((1,), (2,), (3,))
|
self.mock_txn.fetchall.return_value = ((1,), (2,), (3,))
|
||||||
self.mock_txn.description = (
|
self.mock_txn.description = (
|
||||||
("colA", None, None, None, None, None, None),
|
("colA", None, None, None, None, None, None),
|
||||||
)
|
)
|
||||||
|
|
||||||
ret = yield self.datastore._simple_select_list(
|
ret = yield self.datastore._simple_select_list(
|
||||||
table="tablename",
|
table="tablename",
|
||||||
keyvalues={"keycol": "A set"},
|
keyvalues={"keycol": "A set"},
|
||||||
retcols=["colA"],
|
retcols=["colA"],
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEquals([{"colA": 1}, {"colA": 2}, {"colA": 3}], ret)
|
self.assertEquals([{"colA": 1}, {"colA": 2}, {"colA": 3}], ret)
|
||||||
self.mock_txn.execute.assert_called_with(
|
self.mock_txn.execute.assert_called_with(
|
||||||
"SELECT colA FROM tablename WHERE keycol = ?",
|
"SELECT colA FROM tablename WHERE keycol = ?",
|
||||||
["A set"]
|
["A set"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -159,14 +157,14 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
||||||
self.mock_txn.rowcount = 1
|
self.mock_txn.rowcount = 1
|
||||||
|
|
||||||
yield self.datastore._simple_update_one(
|
yield self.datastore._simple_update_one(
|
||||||
table="tablename",
|
table="tablename",
|
||||||
keyvalues={"keycol": "TheKey"},
|
keyvalues={"keycol": "TheKey"},
|
||||||
updatevalues={"columnname": "New Value"}
|
updatevalues={"columnname": "New Value"}
|
||||||
)
|
)
|
||||||
|
|
||||||
self.mock_txn.execute.assert_called_with(
|
self.mock_txn.execute.assert_called_with(
|
||||||
"UPDATE tablename SET columnname = ? WHERE keycol = ?",
|
"UPDATE tablename SET columnname = ? WHERE keycol = ?",
|
||||||
["New Value", "TheKey"]
|
["New Value", "TheKey"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -174,15 +172,15 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
||||||
self.mock_txn.rowcount = 1
|
self.mock_txn.rowcount = 1
|
||||||
|
|
||||||
yield self.datastore._simple_update_one(
|
yield self.datastore._simple_update_one(
|
||||||
table="tablename",
|
table="tablename",
|
||||||
keyvalues=OrderedDict([("colA", 1), ("colB", 2)]),
|
keyvalues=OrderedDict([("colA", 1), ("colB", 2)]),
|
||||||
updatevalues=OrderedDict([("colC", 3), ("colD", 4)])
|
updatevalues=OrderedDict([("colC", 3), ("colD", 4)])
|
||||||
)
|
)
|
||||||
|
|
||||||
self.mock_txn.execute.assert_called_with(
|
self.mock_txn.execute.assert_called_with(
|
||||||
"UPDATE tablename SET colC = ?, colD = ? WHERE " +
|
"UPDATE tablename SET colC = ?, colD = ? WHERE"
|
||||||
"colA = ? AND colB = ?",
|
" colA = ? AND colB = ?",
|
||||||
[3, 4, 1, 2]
|
[3, 4, 1, 2]
|
||||||
)
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -190,11 +188,10 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
||||||
self.mock_txn.rowcount = 1
|
self.mock_txn.rowcount = 1
|
||||||
|
|
||||||
yield self.datastore._simple_delete_one(
|
yield self.datastore._simple_delete_one(
|
||||||
table="tablename",
|
table="tablename",
|
||||||
keyvalues={"keycol": "Go away"},
|
keyvalues={"keycol": "Go away"},
|
||||||
)
|
)
|
||||||
|
|
||||||
self.mock_txn.execute.assert_called_with(
|
self.mock_txn.execute.assert_called_with(
|
||||||
"DELETE FROM tablename WHERE keycol = ?",
|
"DELETE FROM tablename WHERE keycol = ?", ["Go away"]
|
||||||
["Go away"]
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
import uuid
|
|
||||||
from mock import Mock
|
from mock import Mock
|
||||||
from synapse.types import RoomID, UserID
|
from synapse.types import RoomID, UserID
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ class ProfileStoreTestCase(unittest.TestCase):
|
||||||
)
|
)
|
||||||
|
|
||||||
yield self.store.set_profile_avatar_url(
|
yield self.store.set_profile_avatar_url(
|
||||||
self.u_frank.localpart, "http://my.site/here"
|
self.u_frank.localpart, "http://my.site/here"
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
|
|
|
@ -33,8 +33,10 @@ class RegistrationStoreTestCase(unittest.TestCase):
|
||||||
self.store = hs.get_datastore()
|
self.store = hs.get_datastore()
|
||||||
|
|
||||||
self.user_id = "@my-user:test"
|
self.user_id = "@my-user:test"
|
||||||
self.tokens = ["AbCdEfGhIjKlMnOpQrStUvWxYz",
|
self.tokens = [
|
||||||
"BcDeFgHiJkLmNoPqRsTuVwXyZa"]
|
"AbCdEfGhIjKlMnOpQrStUvWxYz",
|
||||||
|
"BcDeFgHiJkLmNoPqRsTuVwXyZa"
|
||||||
|
]
|
||||||
self.pwhash = "{xx1}123456789"
|
self.pwhash = "{xx1}123456789"
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
|
|
@ -37,7 +37,8 @@ class RoomStoreTestCase(unittest.TestCase):
|
||||||
self.alias = RoomAlias.from_string("#a-room-name:test")
|
self.alias = RoomAlias.from_string("#a-room-name:test")
|
||||||
self.u_creator = UserID.from_string("@creator:test")
|
self.u_creator = UserID.from_string("@creator:test")
|
||||||
|
|
||||||
yield self.store.store_room(self.room.to_string(),
|
yield self.store.store_room(
|
||||||
|
self.room.to_string(),
|
||||||
room_creator_user_id=self.u_creator.to_string(),
|
room_creator_user_id=self.u_creator.to_string(),
|
||||||
is_public=True
|
is_public=True
|
||||||
)
|
)
|
||||||
|
@ -45,9 +46,11 @@ class RoomStoreTestCase(unittest.TestCase):
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_get_room(self):
|
def test_get_room(self):
|
||||||
self.assertDictContainsSubset(
|
self.assertDictContainsSubset(
|
||||||
{"room_id": self.room.to_string(),
|
{
|
||||||
"creator": self.u_creator.to_string(),
|
"room_id": self.room.to_string(),
|
||||||
"is_public": True},
|
"creator": self.u_creator.to_string(),
|
||||||
|
"is_public": True
|
||||||
|
},
|
||||||
(yield self.store.get_room(self.room.to_string()))
|
(yield self.store.get_room(self.room.to_string()))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -65,7 +68,8 @@ class RoomEventsStoreTestCase(unittest.TestCase):
|
||||||
|
|
||||||
self.room = RoomID.from_string("!abcde:test")
|
self.room = RoomID.from_string("!abcde:test")
|
||||||
|
|
||||||
yield self.store.store_room(self.room.to_string(),
|
yield self.store.store_room(
|
||||||
|
self.room.to_string(),
|
||||||
room_creator_user_id="@creator:text",
|
room_creator_user_id="@creator:text",
|
||||||
is_public=True
|
is_public=True
|
||||||
)
|
)
|
||||||
|
|
|
@ -88,8 +88,8 @@ class RoomMemberStoreTestCase(unittest.TestCase):
|
||||||
[m.room_id for m in (
|
[m.room_id for m in (
|
||||||
yield self.store.get_rooms_for_user_where_membership_is(
|
yield self.store.get_rooms_for_user_where_membership_is(
|
||||||
self.u_alice.to_string(), [Membership.JOIN]
|
self.u_alice.to_string(), [Membership.JOIN]
|
||||||
))
|
)
|
||||||
]
|
)]
|
||||||
)
|
)
|
||||||
self.assertFalse(
|
self.assertFalse(
|
||||||
(yield self.store.user_rooms_intersect(
|
(yield self.store.user_rooms_intersect(
|
||||||
|
@ -108,11 +108,11 @@ class RoomMemberStoreTestCase(unittest.TestCase):
|
||||||
yield self.store.get_room_members(self.room.to_string())
|
yield self.store.get_room_members(self.room.to_string())
|
||||||
)}
|
)}
|
||||||
)
|
)
|
||||||
self.assertTrue(
|
self.assertTrue((
|
||||||
(yield self.store.user_rooms_intersect(
|
yield self.store.user_rooms_intersect([
|
||||||
[self.u_alice.to_string(), self.u_bob.to_string()]
|
self.u_alice.to_string(), self.u_bob.to_string()
|
||||||
))
|
])
|
||||||
)
|
))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_room_hosts(self):
|
def test_room_hosts(self):
|
||||||
|
@ -136,9 +136,7 @@ class RoomMemberStoreTestCase(unittest.TestCase):
|
||||||
|
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
{"test", "elsewhere"},
|
{"test", "elsewhere"},
|
||||||
(yield
|
(yield self.store.get_joined_hosts_for_room(self.room.to_string()))
|
||||||
self.store.get_joined_hosts_for_room(self.room.to_string())
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Should still have both hosts
|
# Should still have both hosts
|
||||||
|
@ -146,9 +144,7 @@ class RoomMemberStoreTestCase(unittest.TestCase):
|
||||||
|
|
||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
{"test", "elsewhere"},
|
{"test", "elsewhere"},
|
||||||
(yield
|
(yield self.store.get_joined_hosts_for_room(self.room.to_string()))
|
||||||
self.store.get_joined_hosts_for_room(self.room.to_string())
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# Should have only one host after other leaves
|
# Should have only one host after other leaves
|
||||||
|
|
|
@ -156,13 +156,13 @@ class StreamStoreTestCase(unittest.TestCase):
|
||||||
self.room1, self.u_bob, Membership.JOIN
|
self.room1, self.u_bob, Membership.JOIN
|
||||||
)
|
)
|
||||||
|
|
||||||
event1 = yield self.event_injector.inject_room_member(
|
yield self.event_injector.inject_room_member(
|
||||||
self.room1, self.u_alice, Membership.JOIN
|
self.room1, self.u_alice, Membership.JOIN
|
||||||
)
|
)
|
||||||
|
|
||||||
start = yield self.store.get_room_events_max_id()
|
start = yield self.store.get_room_events_max_id()
|
||||||
|
|
||||||
event2 = yield self.event_injector.inject_room_member(
|
yield self.event_injector.inject_room_member(
|
||||||
self.room1, self.u_alice, Membership.JOIN,
|
self.room1, self.u_alice, Membership.JOIN,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,10 @@ class DistributorTestCase(unittest.TestCase):
|
||||||
self.dist.declare("whine")
|
self.dist.declare("whine")
|
||||||
|
|
||||||
d_inner = defer.Deferred()
|
d_inner = defer.Deferred()
|
||||||
|
|
||||||
def observer():
|
def observer():
|
||||||
return d_inner
|
return d_inner
|
||||||
|
|
||||||
self.dist.observe("whine", observer)
|
self.dist.observe("whine", observer)
|
||||||
|
|
||||||
d_outer = self.dist.fire("whine")
|
d_outer = self.dist.fire("whine")
|
||||||
|
@ -66,8 +68,8 @@ class DistributorTestCase(unittest.TestCase):
|
||||||
|
|
||||||
observers[0].side_effect = Exception("Awoogah!")
|
observers[0].side_effect = Exception("Awoogah!")
|
||||||
|
|
||||||
with patch("synapse.util.distributor.logger",
|
with patch(
|
||||||
spec=["warning"]
|
"synapse.util.distributor.logger", spec=["warning"]
|
||||||
) as mock_logger:
|
) as mock_logger:
|
||||||
d = self.dist.fire("alarm", "Go")
|
d = self.dist.fire("alarm", "Go")
|
||||||
yield d
|
yield d
|
||||||
|
@ -77,8 +79,9 @@ class DistributorTestCase(unittest.TestCase):
|
||||||
observers[1].assert_called_once_with("Go")
|
observers[1].assert_called_once_with("Go")
|
||||||
|
|
||||||
self.assertEquals(mock_logger.warning.call_count, 1)
|
self.assertEquals(mock_logger.warning.call_count, 1)
|
||||||
self.assertIsInstance(mock_logger.warning.call_args[0][0],
|
self.assertIsInstance(
|
||||||
str)
|
mock_logger.warning.call_args[0][0], str
|
||||||
|
)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_signal_catch_no_suppress(self):
|
def test_signal_catch_no_suppress(self):
|
||||||
|
|
|
@ -17,6 +17,7 @@ from tests import unittest
|
||||||
|
|
||||||
from tests.utils import MockClock
|
from tests.utils import MockClock
|
||||||
|
|
||||||
|
|
||||||
class MockClockTestCase(unittest.TestCase):
|
class MockClockTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
@ -60,7 +61,7 @@ class MockClockTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def _cb1():
|
def _cb1():
|
||||||
invoked[1] = 1
|
invoked[1] = 1
|
||||||
t1 = self.clock.call_later(20, _cb1)
|
self.clock.call_later(20, _cb1)
|
||||||
|
|
||||||
self.clock.cancel_call_later(t0)
|
self.clock.cancel_call_later(t0)
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,12 @@ def around(target):
|
||||||
def _around(code):
|
def _around(code):
|
||||||
name = code.__name__
|
name = code.__name__
|
||||||
orig = getattr(target, name)
|
orig = getattr(target, name)
|
||||||
|
|
||||||
def new(*args, **kwargs):
|
def new(*args, **kwargs):
|
||||||
return code(orig, *args, **kwargs)
|
return code(orig, *args, **kwargs)
|
||||||
|
|
||||||
setattr(target, name, new)
|
setattr(target, name, new)
|
||||||
|
|
||||||
return _around
|
return _around
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,9 +56,7 @@ class TestCase(unittest.TestCase):
|
||||||
|
|
||||||
method = getattr(self, methodName)
|
method = getattr(self, methodName)
|
||||||
|
|
||||||
level = getattr(method, "loglevel",
|
level = getattr(method, "loglevel", getattr(self, "loglevel", NEVER))
|
||||||
getattr(self, "loglevel",
|
|
||||||
NEVER))
|
|
||||||
|
|
||||||
@around(self)
|
@around(self)
|
||||||
def setUp(orig):
|
def setUp(orig):
|
||||||
|
|
|
@ -12,4 +12,3 @@
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
from twisted.internet import defer
|
|
||||||
from tests import unittest
|
from tests import unittest
|
||||||
|
|
||||||
from synapse.util.caches.dictionary_cache import DictionaryCache
|
from synapse.util.caches.dictionary_cache import DictionaryCache
|
||||||
|
|
|
@ -19,6 +19,7 @@ from .. import unittest
|
||||||
from synapse.util.caches.snapshot_cache import SnapshotCache
|
from synapse.util.caches.snapshot_cache import SnapshotCache
|
||||||
from twisted.internet.defer import Deferred
|
from twisted.internet.defer import Deferred
|
||||||
|
|
||||||
|
|
||||||
class SnapshotCacheTestCase(unittest.TestCase):
|
class SnapshotCacheTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|
|
@ -18,6 +18,7 @@ from .. import unittest
|
||||||
|
|
||||||
from synapse.util.caches.treecache import TreeCache
|
from synapse.util.caches.treecache import TreeCache
|
||||||
|
|
||||||
|
|
||||||
class TreeCacheTestCase(unittest.TestCase):
|
class TreeCacheTestCase(unittest.TestCase):
|
||||||
def test_get_set_onelevel(self):
|
def test_get_set_onelevel(self):
|
||||||
cache = TreeCache()
|
cache = TreeCache()
|
||||||
|
|
|
@ -152,7 +152,7 @@ class MockHttpResource(HttpServer):
|
||||||
|
|
||||||
mock_request.getClientIP.return_value = "-"
|
mock_request.getClientIP.return_value = "-"
|
||||||
|
|
||||||
mock_request.requestHeaders.getRawHeaders.return_value=[
|
mock_request.requestHeaders.getRawHeaders.return_value = [
|
||||||
"X-Matrix origin=test,key=,sig="
|
"X-Matrix origin=test,key=,sig="
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -360,13 +360,12 @@ class MemoryDataStore(object):
|
||||||
|
|
||||||
def get_rooms_for_user_where_membership_is(self, user_id, membership_list):
|
def get_rooms_for_user_where_membership_is(self, user_id, membership_list):
|
||||||
return [
|
return [
|
||||||
self.members[r].get(user_id) for r in self.members
|
m[user_id] for m in self.members.values()
|
||||||
if user_id in self.members[r] and
|
if user_id in m and m[user_id].membership in membership_list
|
||||||
self.members[r][user_id].membership in membership_list
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_room_events_stream(self, user_id=None, from_key=None, to_key=None,
|
def get_room_events_stream(self, user_id=None, from_key=None, to_key=None,
|
||||||
limit=0, with_feedback=False):
|
limit=0, with_feedback=False):
|
||||||
return ([], from_key) # TODO
|
return ([], from_key) # TODO
|
||||||
|
|
||||||
def get_joined_hosts_for_room(self, room_id):
|
def get_joined_hosts_for_room(self, room_id):
|
||||||
|
@ -376,7 +375,6 @@ class MemoryDataStore(object):
|
||||||
if event.type == EventTypes.Member:
|
if event.type == EventTypes.Member:
|
||||||
room_id = event.room_id
|
room_id = event.room_id
|
||||||
user = event.state_key
|
user = event.state_key
|
||||||
membership = event.membership
|
|
||||||
self.members.setdefault(room_id, {})[user] = event
|
self.members.setdefault(room_id, {})[user] = event
|
||||||
|
|
||||||
if hasattr(event, "state_key"):
|
if hasattr(event, "state_key"):
|
||||||
|
@ -456,9 +454,9 @@ class DeferredMockCallable(object):
|
||||||
d.callback(None)
|
d.callback(None)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
failure = AssertionError("Was not expecting call(%s)" %
|
failure = AssertionError("Was not expecting call(%s)" % (
|
||||||
_format_call(args, kwargs)
|
_format_call(args, kwargs)
|
||||||
)
|
))
|
||||||
|
|
||||||
for _, _, d in self.expectations:
|
for _, _, d in self.expectations:
|
||||||
try:
|
try:
|
||||||
|
@ -479,14 +477,12 @@ class DeferredMockCallable(object):
|
||||||
)
|
)
|
||||||
|
|
||||||
timer = reactor.callLater(
|
timer = reactor.callLater(
|
||||||
timeout/1000,
|
timeout / 1000,
|
||||||
deferred.errback,
|
deferred.errback,
|
||||||
AssertionError(
|
AssertionError("%d pending calls left: %s" % (
|
||||||
"%d pending calls left: %s"% (
|
len([e for e in self.expectations if not e[2].called]),
|
||||||
len([e for e in self.expectations if not e[2].called]),
|
[e for e in self.expectations if not e[2].called]
|
||||||
[e for e in self.expectations if not e[2].called]
|
))
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
yield deferred
|
yield deferred
|
||||||
|
@ -500,8 +496,8 @@ class DeferredMockCallable(object):
|
||||||
calls = self.calls
|
calls = self.calls
|
||||||
self.calls = []
|
self.calls = []
|
||||||
|
|
||||||
raise AssertionError("Expected not to received any calls, got:\n" +
|
raise AssertionError(
|
||||||
"\n".join([
|
"Expected not to received any calls, got:\n" + "\n".join([
|
||||||
"call(%s)" % _format_call(c[0], c[1]) for c in calls
|
"call(%s)" % _format_call(c[0], c[1]) for c in calls
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -26,4 +26,4 @@ skip_install = True
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
deps =
|
deps =
|
||||||
flake8
|
flake8
|
||||||
commands = /bin/bash -c "flake8 synapse {env:PEP8SUFFIX:}"
|
commands = /bin/bash -c "flake8 synapse tests {env:PEP8SUFFIX:}"
|
||||||
|
|
Loading…
Reference in a new issue