예제 #1
0
파일: streamer_test.py 프로젝트: tilgovi/h
    def test_should_send_event_does_not_send_nipsad_annotations(self):
        """Users should not see annotations from NIPSA'd users."""
        annotation = {"user": "******", "nipsa": True}
        socket = Mock(terminated=False, client_id="foo")
        event_data = {"action": "create", "src_client_id": "bar"}

        assert not should_send_event(socket, annotation, event_data)
예제 #2
0
파일: streamer_test.py 프로젝트: hylhero/h
 def test_should_send_event_check_permissions(self):
     self.sock_giraffe.request.has_permission.return_value = False
     anno = object()
     data = {'action': 'update', 'src_client_id': 'pigeon'}
     sock = self.sock_giraffe
     assert should_send_event(sock, anno, data) is False
     assert sock.request.has_permission.called_with('read', anno)
예제 #3
0
 def test_should_send_event_check_permissions(self):
     self.sock_giraffe.request.has_permission.return_value = False
     anno = object()
     data = {'action': 'update', 'src_client_id': 'pigeon'}
     sock = self.sock_giraffe
     assert should_send_event(sock, anno, data) is False
     assert sock.request.has_permission.called_with('read', anno)
예제 #4
0
파일: streamer_test.py 프로젝트: hylhero/h
    def test_should_send_event_does_not_send_nipsad_annotations(self):
        """Users should not see annotations from NIPSA'd users."""
        annotation = {'user': '******', 'nipsa': True}
        socket = Mock(terminated=False, client_id='foo')
        socket.request.has_permission.return_value = True
        event_data = {'action': 'create', 'src_client_id': 'bar'}

        assert not should_send_event(socket, annotation, event_data)
예제 #5
0
파일: streamer_test.py 프로젝트: tilgovi/h
    def test_should_send_event_does_send_nipsad_annotations(self):
        """NIPSA'd users should see their own annotations."""
        annotation = {"user": "******", "nipsa": True}
        socket = Mock(terminated=False, client_id="foo")
        socket.request.authenticated_userid = "fred"  # The annotation creator.
        event_data = {"action": "create", "src_client_id": "bar"}

        assert should_send_event(socket, annotation, event_data)
예제 #6
0
파일: streamer_test.py 프로젝트: tilgovi/h
    def test_should_send_event_does_not_send_group_annotations(self):
        """Users shouldn't see annotations in groups they aren't members of."""
        annotation = {"user": "******", "permissions": {"read": ["group:private-group"]}}
        socket = Mock(terminated=False, client_id="foo")
        socket.request.effective_principals = []  # No 'group:private-group'.
        event_data = {"action": "create", "src_client_id": "bar"}

        assert not should_send_event(socket, annotation, event_data)
예제 #7
0
파일: streamer_test.py 프로젝트: tilgovi/h
    def test_should_send_event_does_not_crash_if_no_group(self):
        """Users should see annotations from groups they are members of."""
        annotation = {"user": "******", "permissions": {"read": ["group:__world__"]}}
        socket = Mock(terminated=False, client_id="foo")
        socket.request.effective_principals = ["group:private-group"]
        event_data = {"action": "create", "src_client_id": "bar"}

        assert should_send_event(socket, annotation, event_data)
예제 #8
0
    def test_should_send_event_does_not_send_nipsad_annotations(self):
        """Users should not see annotations from NIPSA'd users."""
        annotation = {'user': '******', 'nipsa': True}
        socket = Mock(terminated=False, client_id='foo')
        socket.request.has_permission.return_value = True
        event_data = {'action': 'create', 'src_client_id': 'bar'}

        assert not should_send_event(socket, annotation, event_data)
예제 #9
0
파일: streamer_test.py 프로젝트: hylhero/h
    def test_should_send_event_does_send_nipsad_annotations(self):
        """NIPSA'd users should see their own annotations."""
        annotation = {'user': '******', 'nipsa': True}
        socket = Mock(terminated=False, client_id='foo')
        socket.request.has_permission.return_value = True
        socket.request.authenticated_userid = 'fred'  # The annotation creator.
        event_data = {'action': 'create', 'src_client_id': 'bar'}

        assert should_send_event(socket, annotation, event_data)
예제 #10
0
    def test_should_send_event_does_send_nipsad_annotations(self):
        """NIPSA'd users should see their own annotations."""
        annotation = {'user': '******', 'nipsa': True}
        socket = Mock(terminated=False, client_id='foo')
        socket.request.has_permission.return_value = True
        socket.request.authenticated_userid = 'fred'  # The annotation creator.
        event_data = {'action': 'create', 'src_client_id': 'bar'}

        assert should_send_event(socket, annotation, event_data)
예제 #11
0
파일: streamer_test.py 프로젝트: tilgovi/h
 def test_should_send_event_doesnt_send_reads(self):
     data = {"action": "read", "src_client_id": "pigeon"}
     assert should_send_event(self.sock_giraffe, {}, data) is False
예제 #12
0
 def test_should_send_event_doesnt_send_reads(self):
     data = {'action': 'read', 'src_client_id': 'pigeon'}
     assert should_send_event(self.sock_giraffe, {}, data) is False
예제 #13
0
 def test_should_send_event_filtered(self):
     self.sock_pigeon.filter.match.return_value = False
     data = {'action': 'update', 'src_client_id': 'giraffe'}
     assert should_send_event(self.sock_pigeon, {}, data) is False
예제 #14
0
 def test_terminated_socket_does_not_recieve_event(self):
     data = {'action': 'update', 'src_client_id': 'pigeon'}
     assert should_send_event(self.sock_roadkill, {}, data) is False
예제 #15
0
 def test_should_send_event_no_filter(self):
     self.sock_giraffe.filter = None
     data = {'action': 'update', 'src_client_id': 'pigeon'}
     assert should_send_event(self.sock_giraffe, {}, data) is False
예제 #16
0
 def test_non_sending_socket_receives_event(self):
     data = {'action': 'update', 'src_client_id': 'pigeon'}
     assert should_send_event(self.sock_giraffe, {}, data)
예제 #17
0
 def test_sending_socket_does_not_receive_event(self):
     data = {'action': 'update', 'src_client_id': 'pigeon'}
     assert should_send_event(self.sock_pigeon, {}, data) is False
예제 #18
0
파일: streamer_test.py 프로젝트: hylhero/h
 def test_should_send_event_no_filter(self):
     self.sock_giraffe.filter = None
     data = {'action': 'update', 'src_client_id': 'pigeon'}
     assert should_send_event(self.sock_giraffe, {}, data) is False
예제 #19
0
파일: streamer_test.py 프로젝트: hylhero/h
 def test_terminated_socket_does_not_recieve_event(self):
     data = {'action': 'update', 'src_client_id': 'pigeon'}
     assert should_send_event(self.sock_roadkill, {}, data) is False
예제 #20
0
파일: streamer_test.py 프로젝트: hylhero/h
 def test_should_send_event_filtered(self):
     self.sock_pigeon.filter.match.return_value = False
     data = {'action': 'update', 'src_client_id': 'giraffe'}
     assert should_send_event(self.sock_pigeon, {}, data) is False
예제 #21
0
파일: streamer_test.py 프로젝트: hylhero/h
 def test_should_send_event_doesnt_send_reads(self):
     data = {'action': 'read', 'src_client_id': 'pigeon'}
     assert should_send_event(self.sock_giraffe, {}, data) is False
예제 #22
0
파일: streamer_test.py 프로젝트: hylhero/h
 def test_sending_socket_does_not_receive_event(self):
     data = {'action': 'update', 'src_client_id': 'pigeon'}
     assert should_send_event(self.sock_pigeon, {}, data) is False
예제 #23
0
파일: streamer_test.py 프로젝트: tilgovi/h
 def test_non_sending_socket_receives_event(self):
     data = {"action": "update", "src_client_id": "pigeon"}
     assert should_send_event(self.sock_giraffe, {"permissions": {"read": ["group:__world__"]}}, data)
예제 #24
0
파일: streamer_test.py 프로젝트: tilgovi/h
 def test_should_send_event_no_filter(self):
     self.sock_giraffe.filter = None
     data = {"action": "update", "src_client_id": "pigeon"}
     assert should_send_event(self.sock_giraffe, {"permissions": {"read": ["group:__world__"]}}, data) is False
예제 #25
0
파일: streamer_test.py 프로젝트: tilgovi/h
 def test_terminated_socket_does_not_recieve_event(self):
     data = {"action": "update", "src_client_id": "pigeon"}
     assert should_send_event(self.sock_roadkill, {}, data) is False
예제 #26
0
파일: streamer_test.py 프로젝트: tilgovi/h
 def test_sending_socket_does_not_receive_event(self):
     data = {"action": "update", "src_client_id": "pigeon"}
     assert should_send_event(self.sock_pigeon, {}, data) is False
예제 #27
0
파일: streamer_test.py 프로젝트: tilgovi/h
 def test_should_send_event_filtered(self):
     self.sock_pigeon.filter.match.return_value = False
     data = {"action": "update", "src_client_id": "giraffe"}
     assert should_send_event(self.sock_pigeon, {"permissions": {"read": ["group:__world__"]}}, data) is False
예제 #28
0
파일: streamer_test.py 프로젝트: hylhero/h
 def test_non_sending_socket_receives_event(self):
     data = {'action': 'update', 'src_client_id': 'pigeon'}
     assert should_send_event(self.sock_giraffe, {}, data)