Exemple #1
0
def city():
    return random.choice([
        '%s %s%s' % (city_prefix(), first_name(), city_suffix()),
        '%s %s' % (city_prefix(), first_name()),
        '%s%s' % (first_name(), city_suffix()),
        '%s%s' % (last_name(), city_suffix()),
    ])
Exemple #2
0
def city():
    return random.choice([
        '%s %s%s' % (city_prefix(), first_name(), city_suffix()),
        '%s %s' % (city_prefix(), first_name()),
        '%s%s' % (first_name(), city_suffix()),
        '%s%s' % (last_name(), city_suffix()),
    ])
Exemple #3
0
def street_name():
    return random.choice([
        ' '.join([last_name(), street_suffix()]),
        ' '.join([first_name(), street_suffix()])
    ])
Exemple #4
0
    def handle(self, *args, **options):
        
        project = factories.ProjectFactory(name='Dummy Project', slug='dummy-project')
        admin = factories.UserFactory(first_name='Fabio', last_name='Sussetto', password='******', project=project, is_superuser=True)
        
        t1 = factories.GroupFactory(name='Frontend Team', project=project)
        t2 = factories.GroupFactory(name='Backend Team', project=project)
        t3 = factories.GroupFactory(name='Analytics Team', project=project)
        
        approver1 = factories.UserFactory(
                first_name=name.first_name(),
                last_name=name.last_name(),
                email=faker.internet.email(),
                password='******',
                project=project,
                is_superuser=False,
                approval_group=t1
            )
        
        approver2 = factories.UserFactory(
                first_name=name.first_name(),
                last_name=name.last_name(),
                password='******',
                email=faker.internet.email(),
                project=project,
                is_superuser=False,
                approval_group=t1
            )
        
        approver3 = factories.UserFactory(
                first_name=name.first_name(),
                last_name=name.last_name(),
                password='******',
                email=faker.internet.email(),
                project=project,
                is_superuser=False,
                approval_group=t1
            )
        
        approver4 = factories.UserFactory(
                first_name=name.first_name(),
                last_name=name.last_name(),
                password='******',
                email=faker.internet.email(),
                project=project,
                is_superuser=False,
                approval_group=t1
            )
        
        rule1 = factories.ApprovalRuleFactory(
            group=t1,
            order=0,
            approver=approver1
        )
        rule2 = factories.ApprovalRuleFactory(
            group=t1,
            order=1,
            approver=approver2
        )

        rule3 = factories.ApprovalRuleFactory(
            group=t2,
            order=0,
            approver=approver3
        )
        
        rule4 = factories.ApprovalRuleFactory(
            group=t3,
            order=0,
            approver=approver4
        )
        
        t1_users = t2_users = t3_users = []
                
        for i in range(0, 25):
            t1_users.append(factories.UserFactory(
                first_name=name.first_name(),
                last_name=name.last_name(),
                email=faker.internet.email(),
                password='******',
                project=project,
                is_superuser=False,
                approval_group=t1
            ))
        
        for i in range(0, 15):
            t2_users.append(factories.UserFactory(
                first_name=name.first_name(),
                last_name=name.last_name(),
                password='******',
                project=project,
                is_superuser=False,
                approval_group=t2
            ))
            
        for i in range(0, 10):
            t3_users.append(factories.UserFactory(
                first_name=name.first_name(),
                last_name=name.last_name(),
                password='******',
                project=project,
                is_superuser=False,
                approval_group=t3
            ))
            
        distribution = ((t1_users, 20), (t2_users, 10), (t3_users, 10))
            
        for users, num in distribution:
            for i in range(0, num):
                start, end = random_daterange(date(2012, 11, 22), date(2012, 12, 22), 1, 7)
                
                r = factories.HolidayRequestFactory.build(
                    requested_on=start - timedelta(days=random.randint(2, 15)),
                    start_date=start,
                    end_date=end,
                    author=random.choice(users),
                    project=project
                )
                
                r, approvals = r.submit()
                if random.randint(0, 1):
                    for approval in approvals:
                        approval.approve()
Exemple #5
0
def user_name(n=None):
    if n is not None:
        sep = random.choice(['.', '_'])
        matches = re.findall(r'\w+', n)
        random.shuffle(matches)
        return sep.join(matches).lower()
    return random.choice([
        lambda: re.sub(r'\W+', '', name.first_name()).lower(),
        lambda: random.choice(['.', '_']).join(re.sub(r'\W+', '', n) for n in [name.first_name(), name.last_name()]).lower()
    ])()
Exemple #6
0
def user_name(n=None):
    if n is not None:
        sep = random.choice(['.', '_'])
        matches = re.findall(r'\w+', n)
        random.shuffle(matches)
        return sep.join(matches).lower()
    return random.choice([
        lambda: re.sub(r'\W+', '', name.first_name()).lower(),
        lambda: random.choice(['.', '_']).join(re.sub(r'\W+', '', n) for n in [name.first_name(), name.last_name()]).lower()
    ])()
Exemple #7
0
import random

from faker.generators import name as fake_name

formats = [
  lambda: ' '.join([fake_name.last_name(), suffix()]),
  lambda: '-'.join([fake_name.last_name(), fake_name.last_name()]),
  lambda: '%s, %s and %s' % tuple([fake_name.last_name() for i in range(3)]),
]

def name():
    return random.choice(formats)()
    
def suffix():
    return random.choice(['Inc', 'and Sons', 'LLC', 'Group'])
      
# Generate a buzzword-laden catch phrase.
# Wordlist from http://www.1728.com/buzzword.htm
def catch_phrase():
    return ' '.join([
        random.choice([
            "Adaptive", "Advanced", "Ameliorated", "Assimilated", "Automated",
            "Balanced", "Business-focused", "Centralized", "Cloned", "Compatible",
            "Configurable", "Cross-group", "Cross-platform", "Customer-focused",
            "Customizable", "Decentralized", "De-engineered", "Devolved",
            "Digitized", "Distributed", "Diverse", "Down-sized", "Enhanced",
            "Enterprise-wide", "Ergonomic", "Exclusive", "Expanded", "Extended",
            "Face to face", "Focused", "Front-line", "Fully-configurable",
            "Function-based", "Fundamental", "Future-proofed", "Grass-roots",
            "Horizontal", "Implemented", "Innovative", "Integrated", "Intuitive",
            "Inverse", "Managed", "Mandatory", "Monitored", "Multi-channelled",
Exemple #8
0
def street_name():
    return random.choice([
        ' '.join([last_name(), street_suffix()]),
        ' '.join([first_name(), street_suffix()])
    ])
Exemple #9
0
def fr_street_name():
    return random.choice([
        ' '.join([fr_street_suffix(), last_name()]),
        ' '.join([fr_street_suffix(), first_name()])
    ])
Exemple #10
0
import random

from faker.generators import name as fake_name

formats = [
    lambda: ' '.join([fake_name.last_name(), suffix()]),
    lambda: '-'.join([fake_name.last_name(),
                      fake_name.last_name()]),
    lambda: '%s, %s and %s' % tuple([fake_name.last_name() for i in range(3)]),
]


def name():
    return random.choice(formats)()


def suffix():
    return random.choice(['Inc', 'and Sons', 'LLC', 'Group'])


# Generate a buzzword-laden catch phrase.
# Wordlist from http://www.1728.com/buzzword.htm
def catch_phrase():
    return ' '.join([
        random.choice([
            "Adaptive", "Advanced", "Ameliorated", "Assimilated", "Automated",
            "Balanced", "Business-focused", "Centralized", "Cloned",
            "Compatible", "Configurable", "Cross-group", "Cross-platform",
            "Customer-focused", "Customizable", "Decentralized",
            "De-engineered", "Devolved", "Digitized", "Distributed", "Diverse",
            "Down-sized", "Enhanced", "Enterprise-wide", "Ergonomic",