def createGroupAuth(): email = session['email'] groupName = request.form['GroupName'] if not Group.checkIfGroupExists(groupName, conn): Group.insertGroupDetails(email, groupName, conn) newGroup = Group(groupName, User.fetchUsername(session['email'], conn)) activeGroups.append(newGroup) session['group'] = newGroup.name newGroup.startDJRotateThread() return redirect('/group') else: error = 'A group with this name already exists! Please try again.' return render_template('createGroup.html', error=error)
def test_insertGroupDetails(): Group.insertGroupDetails(email1, group1, conn) assert Group.checkIfGroupExists(group1, conn) == {'ownerEmail': '*****@*****.**', 'groupName': 'Psychedelic Rock'} Group.insertGroupDetails(email2, group2, conn) assert Group.checkIfGroupExists(group2, conn) == {'ownerEmail': '*****@*****.**', 'groupName': 'Anton LaVey Chants'} assert Group.checkIfGroupExists(group3, conn) == None