def test_user_all04(): user1 = auth.register("*****@*****.**", "test", "John", "Smith") user2 = auth.register("*****@*****.**", "Example", "Jhn", "Smith") user3 = auth.register("*****@*****.**", "Example", "Jon", "Smith") user4 = auth.register("*****@*****.**", "Example", "Bon", "Smoth") pub_channel = channels.create(user1['token'], 'awesomechannel', True) priv_channel = channels.create(user2['token'], 'notcool', False) channel.joi(user3['token'],pub_channel['channel_id']) channel.joi(user2['token'],priv_channel['channel_id']) users_dictionary = { 'users' : [ profile(user1['token'],user1['u_id']), profile(user2['token'],user2['u_id']), profile(user3['token'],user3['u_id']), profile(user4['token'],user4['u_id']) ] } assert all_(user1['token']) == users_dictionary assert all_(user2['token']) == users_dictionary assert all_(user3['token']) == users_dictionary assert all_(user4['token']) == users_dictionary
def create_data(id): workspace_reset() if id == 1: testUser = register("*****@*****.**", "password123", "Test", "User") testChannel = create(testUser['token'], "testChannel", True) return (testUser, testChannel) elif id == 2: testUser = register("*****@*****.**", "password123", "Test2", "User2") testChannel = create(testUser['token'], "testChannel2", True) return (testUser, testChannel)
class _validUser: details = register("*****@*****.**", "GoodPassword", "Plebian", "Person") details2 = register("*****@*****.**", "veryGoodPassword", "Noble", "Person") details_part_owner = register("*****@*****.**", "very_partially_owner", "Yes", "WhyWouldntIbe")
def test_user_all02(): user1 = auth.register("*****@*****.**", "test", "John", "Smith") user2 = auth.register("*****@*****.**", "Example", "John", "Smith") user3 = auth.register("*****@*****.**", "Example", "John", "Smith") users_dictionary = { 'users' : [ profile(user1['token'],user1['u_id'])['user'], profile(user2['token'],user2['u_id'])['user'], profile(user3['token'],user3['u_id'])['user'] ] } assert all_(user2['token']) == users_dictionary
class _owner(_validUser): # Register an owner details = register("*****@*****.**", "AmazingPassword", "Hyper", "Swine") # Create a public channel real_channel = chs.create(details["token"], "CNN_aka_fake_news", True) # Create a private channel priv_channel = chs.create(details["token"], "Nine_News", False) # Send some messages msgs_ids = _send_messages(details, real_channel["channel_id"], 10) # Dictionary of all channels all_channels = chs.listall(details["token"]) # Dictionary of channels you belong to some_channels = chs.list_(details["token"]) # Dictionary of channel members ch_members = ch.det(details["token"], real_channel["channel_id"]) # Add user as member ch.inv(details["token"], real_channel["channel_id"], _validUser.details_part_owner["u_id"]) # Add another user as owner ch.add_owner(details["token"], real_channel["channel_id"], _validUser.details_part_owner["u_id"])
def auto_register(): ''' Once called, registers the bot to the slackr. ''' global user_data # check if bot has already been registered bot_id = discrete.find_uid("*****@*****.**") if bot_id != -1: print("Bot has already been registered") if not user_data[bot_id]["is_logged_in"]: login("*****@*****.**", "1010101000101010") return # register the bot register(bot_data["email"], bot_data["password"], bot_data["first_name"], bot_data["last_name"]) user_data[bot_id][ "profile_img_url"] = "http://127.0.0.1:8080/profileimages/bot.jpg"
def auth_register(): data = request.get_json() return dumps(auth.register(data["email"], data["password"], data["name_first"], \ data["name_last"]))
def create_user(): workspace_reset() return register("*****@*****.**", "password123", "Test", "User")
def test_sethandle06(): new_user = create_user() test_user = auth.register('*****@*****.**','Test', 'John', 'Smith') with pytest.raises(InputError): sethandle(new_user['token'],test_user['handle_str'])
def test_setemail05(): test_user = auth.register("*****@*****.**", "Test", "John", "Smith") new_user = create_user() #New_user will be trying to change their email to test_ with pytest.raises(InputError): setemail(new_user['token'],'*****@*****.**')
def create_user2(): return auth.register('*****@*****.**', 'Example2', 'Donaldo', 'Trumpu')
def create_user(): workspace_reset() return auth.register('*****@*****.**', 'Example', 'John', 'Smith')