def test_twitter_proof(self):
        """ Check twitter proof
        """

        for username in test_users:
            profile = get_profile(username)
            proofs = profile_to_proofs(profile, username)

            for proof in proofs:

                if proof["service"] == "twitter":
                    self.assertTrue(proof["valid"])
Beispiel #2
0
    def test_twitter_proof(self):
        """ Check twitter proof
        """

        for username in test_users:
            profile = get_profile(username)
            proofs = profile_to_proofs(profile, username)

            for proof in proofs:

                if proof['service'] == 'twitter':
                    self.assertTrue(proof['valid'])
Beispiel #3
0
def format_profile(profile, username):
    """ Process profile data and
        1) Insert verifications
        2) Check if profile data is valid JSON
    """

    data = {}

    if 'error' in profile:
        data['profile'] = None
        data['error'] = "Malformed profile data"
        data['verifications'] = []
    else:
        data['profile'] = profile
        data['verifications'] = profile_to_proofs(profile, username)

    return data
Beispiel #4
0
def get_proofs(username, profile):

    check_proofs = proofs_cache.find_one({"username": username})

    if check_proofs is None:

        try:
            proofs = profile_to_proofs(profile, username)
        except:
            proofs = []

        new_entry = {}
        new_entry['username'] = username
        new_entry['proofs'] = proofs
        proofs_cache.save(new_entry)
    else:
        print "hitting cache!"
        proofs = check_proofs['proofs']

    return proofs
def get_proofs(username, profile):

    check_proofs = proofs_cache.find_one({"username": username})

    if check_proofs is None:

        try:
            proofs = profile_to_proofs(profile, username)
        except:
            proofs = []

        new_entry = {}
        new_entry['username'] = username
        new_entry['proofs'] = proofs
        proofs_cache.save(new_entry)
    else:
        print "hitting cache!"
        proofs = check_proofs['proofs']

    return proofs