예제 #1
0
def test_channel_join():
    test_user = auth_register("*****@*****.**", "password", "John",
                              "Smith")
    test_user2 = auth_register("*****@*****.**", "password", "Bob",
                               "Smith")
    test_channel = channels_create(test_user["token"], "test_channel", True)
    channel_join(test_user2["token"], test_channel["channel_id"])
예제 #2
0
def test_channel_join_AccessError():
    test_user = auth_register("*****@*****.**", "password", "John",
                              "Smith")
    test_user2 = auth_register("*****@*****.**", "password", "Bob",
                               "Smith")
    test_channel = channels_create(test_user["token"], "test_channel", False)
    with pytest.raises(AccessError):
        channel_join(test_user2["token"], test_channel["channel_id"])
예제 #3
0
def test_channel_join_InvalidToken():
    test_user = auth_register("*****@*****.**", "password", "John",
                              "Smith")
    test_user2 = auth_register("*****@*****.**", "password", "Bob",
                               "Smith")
    test_channel = channels_create(test_user2["token"], "test_channel", True)
    auth_logout(test_user["token"])  # Invalidating token of user1
    with pytest.raises(AccessError):
        channel_join(test_user["token"], test_channel["channel_id"])
예제 #4
0
def channel_join_wsgi():
    json = request.get_json()
    return jsonify(channel_join(json['token'], int(json['channel_id'])))
예제 #5
0
def test_channel_join_InputError():
    test_user = auth_register("*****@*****.**", "password", "John",
                              "Smith")
    with pytest.raises(InputError):
        channel_join(test_user["token"], 0)