Beispiel #1
0
def _get_sw_nickname(seed=None):
    return NameGenerator(use_characters=True,
                         use_species=False,
                         use_planets=False,
                         lowercase=True,
                         separator='_',
                         seed=seed)\
        .generate()
Beispiel #2
0
    def handle_get_user_data(self):
        token = self.get_argument('access_token')
        fields = [
            field for field in self.get_argument('fields', '').split(',')
            if field
        ]
        generator = NameGenerator(lowercase=True, separator=" ")

        name = generator.generate()
        user_id = b64encode(str(uuid4()))
        username = name.lower().replace(' ', '.')
        birthday = datetime(day=25, month=4, year=random.randint(1970, 2000))
        email = "*****@*****.**" % username
        gender = random.choice(['F', 'M'])
        names = name.split()
        first_name = names[0]
        middle_name = ' '.join(names[1:-1])
        last_name = names[-1]
        relationship = random.choice(['Single', 'Married', 'Complicated'])
        verified = True

        userdata = {
            "id": user_id,
            "access_token": token,
            "birthday": birthday.strftime("%m/%d/%Y"),
            "email": email,
            "first_name": first_name,
            "gender": gender,
            "is_verified": verified,
            "last_name": last_name,
            "middle_name": middle_name,
            "relationship_status": relationship
        }

        if fields:
            data = {'access_token': token}
            for field in fields:
                data[field] = userdata[field]
            userdata = data

        self.write(dumps(userdata))
        self.finish()
Beispiel #3
0
    def handle_get_user_data(self):
        token = self.get_argument('access_token')
        fields = [field for field in self.get_argument('fields', '').split(',') if field]
        generator = NameGenerator(lowercase=True, separator=" ")

        name = generator.generate()
        user_id = b64encode(str(uuid4()))
        username = name.lower().replace(' ', '.')
        birthday = datetime(day=25, month=4, year=random.randint(1970, 2000))
        email = "*****@*****.**" % username
        gender = random.choice(['F', 'M'])
        names = name.split()
        first_name = names[0]
        middle_name = ' '.join(names[1:-1])
        last_name = names[-1]
        relationship = random.choice(['Single', 'Married', 'Complicated'])
        verified = True

        userdata = {
            "id": user_id,
            "access_token": token,
            "birthday": birthday.strftime("%m/%d/%Y"),
            "email": email,
            "first_name": first_name,
            "gender": gender,
            "is_verified": verified,
            "last_name": last_name,
            "middle_name": middle_name,
            "relationship_status": relationship
        }

        if fields:
            data = {
                'access_token': token
            }
            for field in fields:
                data[field] = userdata[field]
            userdata = data

        self.write(dumps(userdata))
        self.finish()
Beispiel #4
0
 def test_can_generate_names_without_species(self):
     generator = NameGenerator(use_species=False, seed="test-5")
     expect(generator.generate()).to_equal("Corellia-Rush-Clovis")
Beispiel #5
0
 def test_can_generate_names_without_characters_and_species(self):
     generator = NameGenerator(use_characters=False, use_species=False, seed="test-4")
     expect(generator.generate()).to_equal("Taanab")
Beispiel #6
0
 def test_can_generate_lowercase_name(self):
     generator = NameGenerator(lowercase=True, seed="test-3")
     expect(generator.generate()).to_equal("centax-1-bouncer-thire")
Beispiel #7
0
 def test_can_generate_names_without_characters(self):
     generator = NameGenerator(use_characters=False, seed="test-2")
     expect(generator.generate()).to_equal("Utapau-Yaka")
Beispiel #8
0
 def test_can_generate_names(self):
     generator = NameGenerator(seed="test-1")
     expect(generator.generate()).to_equal("Rori-Latter-Ponda-Baba")