Пример #1
0
    def test_add_new_negative(self):
        test0 = createProfile(testProfiles[0])
        uid0 = test0["id"]
        createMatch(Profile.objects.get(pk=uid0))

        test1 = createProfile(diffProfile)
        uid1 = test1["id"]
        createMatch(Profile.objects.get(pk=uid1))
        matchList = returnListOfMatches(uid0)

        assert len(matchList["Matches"]) == 0
Пример #2
0
    def test_remove_member(self):
        test = {}
        uid = {}
        for x in range(0, 6):
            test[x] = createProfile(testProfiles[x])
            uid[x] = test[x]["id"]
            createMatch(Profile.objects.get(pk=uid[x]))

        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount

        request = {}
        request["user1"] = uid[0]
        request["user2"] = uid[1]

        match = returnMatch(request)
        matchAccept(uid[0], match, True)
        matchAccept(uid[1], match, True)

        groupID = createGroup("TestGroup", uid[0])
        group = Match.objects.get(pk=groupID["matchid"])
        assert group.group_name == "TestGroup"
        assert len(group.group_members.all().filter(id=uid[0])) == 1

        groupAdd(match.id, group.id, uid[0])
        assert len(group.group_members.all()) == 2
        assert len(returnGroupContacts(uid[0], group.id)["matchID"]) == 0

        groupLeave(uid[0], group.id)
        assert len(returnGroups(uid[0])["matchID"]) == 0
Пример #3
0
    def test_remove_contacts(self):
        test = {}
        uid = {}
        for x in range(0, 6):
            test[x] = createProfile(testProfiles[x])
            uid[x] = test[x]["id"]
            createMatch(Profile.objects.get(pk=uid[x]))

        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount

        request = {}
        request["user1"] = uid[0]
        request["user2"] = uid[1]

        match = returnMatch(request)
        matchAccept(uid[0], match, True)
        matchAccept(uid[1], match, True)

        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount-1

        contactList = returnContacts(uid[0])
        assert contactList["matchID"][0] == match.id

        removeContact(match.id, uid[0])
        contactList = returnContacts(uid[0])
        assert len(contactList["matchID"]) == 0
Пример #4
0
    def test_diff_matches(self):
        test = {}
        uid = {}
        for x in range(0, 6):
            test[x] = createProfile(testProfiles[x])
            uid[x] = test[x]["id"]
            createMatch(Profile.objects.get(pk=uid[x]))
        
        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount

        testIDs = {}
        for x in range(0, listAmount - 1):
            testIDs[x] = matchList["Matches"][x]

        test[6] = createProfile(testProfiles[6])
        uid[6] = test[6]["id"]
        createMatch(Profile.objects.get(pk=uid[6]))
            
        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount

        assert testIDs[0] != matchList["Matches"][0]
Пример #5
0
    def test_ten_matches(self):
        test = {}
        uid = {}
        for x in range(0, 10):
            test[x] = createProfile(testProfiles[x])
            uid[x] = test[x]["id"]
            createMatch(Profile.objects.get(pk=uid[x]))
        
        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount

        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount

        test[10] = createProfile(testProfiles[10])
        uid[10] = test[10]["id"]
        createMatch(Profile.objects.get(pk=uid[10]))

        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount

        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount
Пример #6
0
    def test_update_matches(self):
        test = {}
        uid = {}
        for x in range(0, 6):
            test[x] = createProfile(testProfiles[x])
            uid[x] = test[x]["id"]
            createMatch(Profile.objects.get(pk=uid[x]))

        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount

        modifyProfile(diffProfile,uid[1])
        updateMatch(Profile.objects.get(pk=uid[1]))

        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount-1
Пример #7
0
    def test_decline_matches(self):
        test = {}
        uid = {}
        for x in range(0, 6):
            test[x] = createProfile(testProfiles[x])
            uid[x] = test[x]["id"]
            createMatch(Profile.objects.get(pk=uid[x]))
        
        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount

        request = {}
        request["user1"] = uid[0]
        request["user2"] = uid[1]

        match = returnMatch(request)
        matchAccept(uid[0], match, False)

        matchList = returnListOfMatches(uid[0])
        assert len(matchList["Matches"]) == listAmount-1