def run_standup_send(): request_data = request.form return_value = {} standup.standup_send( request_data["token"], int(request_data["channel_id"]), request_data["message"], ) return dumps(return_value)
def test_standup_send(): reset_data() #SETUP Begin authRegDict1 = auth_register("*****@*****.**", "qwerty", "John", "Smith") token1 = authRegDict1['token'] channelCreateDict1 = channels_create(token1, 'New Channel', True) channel_id1 = channelCreateDict1['channel_id'] authRegDict2 = auth_register("*****@*****.**", "asdfgh", "Jim", "Smith") token2 = authRegDict2['token'] channelCreateDict2 = channels_create(token2, 'New Channel2', True) channel_id2 = channelCreateDict2['channel_id'] standup_start(token1, channel_id1, 7) #User 2 has not joined the 'New Channel' created by user 1 #SETUP End #Test Case 1: Successful message sent to get bufferred in the standup queue assert standup_send(token1, channel_id1, 'Hello') == {} #Test Case 2: Unsuccessful message due to channel not existing with pytest.raises(ValueError): standup_send( token1, 10, 'Hello') #Invalid channel ID hence the unsuccessful message #Test Case 3: Unsuccessful message due to message being more than 1000 characters with pytest.raises(ValueError): standup_send(token1, channel_id1, 'a' * 1001) #Test Case 4: Unsuccessful message due to user not being a member of the channel with pytest.raises(AccessError): #user 2 has not joined the channel created by user 1 so the message is Unsuccessful standup_send(token2, channel_id1, 'Hello') #Test Case 5: Unsuccessful standup message due to standup not being active with pytest.raises(ValueError): standup_send(token2, channel_id2, 'Hello') auth_logout(token1) auth_logout(token2) reset_data()
def standup2(): token = request.form.get('token') channel_id = request.form.get('channel_id') message = request.form.get('message') standup_send(token, channel_id, message) return dumps({})
def test_standup_all(): restart() authRegisterDict1 = auth_register("*****@*****.**","123456","Tim","Hu") token1 = authRegisterDict1["token"] authRegisterDict2 = auth_register("*****@*****.**","1we33456","Hayden","Smith") token2 = authRegisterDict2["token"] UID2 = authRegisterDict2['u_id'] authRegisterDict3 = auth_register( "*****@*****.**", "1we33ee456", "Jeff", "Lu") token3 = authRegisterDict3["token"] UID3 = authRegisterDict3['u_id'] authRegisterDict4 = auth_register( "*****@*****.**", "jijijij37236", 'daniel', 'quin') token4 = authRegisterDict4["token"] channel_id = channels_create(token1,'test1',True) channel_invite(token1,channel_id,UID2) channel_invite(token1,channel_id,UID3) showtime(20) with pytest.raises(ValueError, match=r".*"): standup_send(token2, channel_id, 'hello') standup_start(token1,channel_id, 20) with pytest.raises(ValueError, match = r".*"): standup_start(token2, channel_id, 20) with pytest.raises(AccessError, match=r".*"): standup_start(token4,channel_id, 20) with pytest.raises(ValueError,match = r".*"): standup_start(token1,-1, 20) with pytest.raises(AccessError, match=r".*"): standup_send(token4, channel_id , 'hello') with pytest.raises(ValueError, match=r".*"): standup_send(token1, -1 , 'hello') with pytest.raises(ValueError, match=r".*"): standup_send(token3, channel_id, "dhbfuyawgefdahdhbfuyawgefdahsgfhiashfuihasfnrweiauehcyaacweynugirnnnnnnnnnnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnfnnnnnnnnnnnnnnnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfaecntyvufyyyyyyyyyyyyyyyfyfyfygyyywyyyyyyyyyyyyyyywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywydhbfuyawgefdahsgfhiashfuihasfnrweiauehcyaacweynugirnnnnnnnnnnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnfnnnnnnnnnnnnnnnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfaecntyvufyyyyyyyyyyyyyyyfyfyfygyyywyyyyyyyyyyyyyyywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywydhbfuyawgefdahsgfhiashfuihasfnrweiauehcyaacweynugirnnnnnnnnnnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnfnnnnnnnnnnnnnnnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfaecntyvufyyyyyyyyyyyyyyyfyfyfygyyywyyyyyyyyyyyyyyywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywyywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywyywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywyysgfhiashfuihasfnrweiauehcyaacweynugirnnnnnnnnnnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnrnfnnnnnnnnnnnnnnnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfnfaecntyvufyyyyyyyyyyyyyyyfyfyfygyyywyyyyyyyyyyyyyyywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywywyy") standup_send(token2,channel_id, 'hello') standup_send(token3,channel_id,'daniel') standup_send(token2,channel_id, 'quin' ) channelDict = load()['channelDict'] for ch in channelDict: if int(channel_id) == ch['channel_id']: assert 'hayden: hello' + '\r\n' + 'jeff: daniel' + '\r\n' + 'hayden: quin' == ch['standlist'] pass
def stndup_snd(): ''' Route to send a message in an existing standup in an existing channel''' return standup_send(request.form.get('token'), request.form.get('channel_id'),\ request.form.get('message'))
def standupsend(): token = get_args('token') channel_id = int(get_args('channel_id')) message = get_args('message') return dumps(standup_send(token, channel_id, message))