Exemplo n.º 1
0
def fake_team(db, teamowner):
    """Create a fake team
    """
    isapproved = [True, False]
    productorservice = ['Product','Service']

    teamname = faker.first_name() + fake_text_id(3)
    teamslugname = faker.city()

    try:
        teamslug = slugize(teamslugname)
        homepage = 'http://www.example.org/' + fake_text_id(3)
        _fake_thing( db
                   , "teams"
                   , slug=teamslug
                   , slug_lower=teamslug.lower()
                   , name=teamname
                   , homepage=homepage
                   , product_or_service=random.sample(productorservice,1)[0]
                   , todo_url=homepage + '/tickets'
                   , onboarding_url=homepage + '/contributing'
                   , owner=teamowner.username
                   , is_approved=random.sample(isapproved,1)[0]
                   , receiving=0.1
                   , nreceiving_from=3
                   )
    except IntegrityError:
        return fake_team(db, teamowner)

    return Team.from_slug(teamslug)
Exemplo n.º 2
0
def fake_team(db, teamowner, teamname=None):
    """Create a fake team
    """
    isapproved = [True, False]
    productorservice = ['Product', 'Service']

    if teamname is None:
        teamname = faker.first_name() + fake_text_id(3)

    try:
        teamslug = slugize(teamname)
        homepage = 'http://www.example.org/' + fake_text_id(3)
        insert_fake_data(db,
                         "teams",
                         slug=teamslug,
                         slug_lower=teamslug.lower(),
                         name=teamname,
                         homepage=homepage,
                         product_or_service=random.sample(productorservice,
                                                          1)[0],
                         todo_url=homepage + '/tickets',
                         onboarding_url=homepage + '/contributing',
                         owner=teamowner.username,
                         is_approved=random.sample(isapproved, 1)[0],
                         receiving=0.1,
                         nreceiving_from=3)
    except (IntegrityError, InvalidTeamName):
        return fake_team(db, teamowner)

    return Team.from_slug(teamslug)
Exemplo n.º 3
0
def fake_team(db, teamowner, teamname=None):
    """Create a fake team
    """
    is_approved = [True, False, None]
    product_or_service = ['Product','Service']

    if teamname is None:
        teamname = faker.first_name() + fake_text_id(3)

    ctime = teamowner.ctime + datetime.timedelta(days=7)

    try:
        teamslug = slugize(teamname)
        homepage = 'http://www.example.org/' + fake_text_id(3)
        insert_fake_data( db
                        , "teams"
                        , slug=teamslug
                        , slug_lower=teamslug.lower()
                        , name=teamname
                        , homepage=homepage
                        , ctime=ctime
                        , product_or_service=random.choice(product_or_service)
                        , onboarding_url=homepage + '/contributing'
                        , owner=teamowner.username
                        , is_approved=random.choice(is_approved)
                        , receiving=6
                        , nreceiving_from=9
                         )
    except (IntegrityError, InvalidTeamName):
        return fake_team(db, teamowner)

    return Team.from_slug(teamslug)
Exemplo n.º 4
0
def fake_team(db, teamowner, teamname=None):
    """Create a fake team
    """
    is_approved = [True, False, None]
    product_or_service = ['Product', 'Service']

    if teamname is None:
        teamname = faker.first_name() + fake_text_id(3)

    ctime = teamowner.ctime + datetime.timedelta(days=7)

    try:
        teamslug = slugize(teamname)
        homepage = 'http://www.example.org/' + fake_text_id(3)
        insert_fake_data(db,
                         "teams",
                         slug=teamslug,
                         slug_lower=teamslug.lower(),
                         name=teamname,
                         homepage=homepage,
                         ctime=ctime,
                         product_or_service=random.choice(product_or_service),
                         onboarding_url=homepage + '/contributing',
                         owner=teamowner.username,
                         is_approved=random.choice(is_approved),
                         receiving=6,
                         nreceiving_from=9)
    except (IntegrityError, InvalidTeamName):
        return fake_team(db, teamowner)

    return Team.from_slug(teamslug)
Exemplo n.º 5
0
 def test_slugize_accepts_letter_in_middle(self):
     assert slugize('1a23') == '1a23'
Exemplo n.º 6
0
 def test_slugize_slugizes(self):
     assert slugize('Foo') == 'Foo'
Exemplo n.º 7
0
 def test_slugize_trims_replacement_dashes(self):
     assert slugize(',,Foo Bar,,') == 'Foo-Bar'
Exemplo n.º 8
0
 def test_slugize_trims_whitespace(self):
     assert slugize('  Foo Bar  ') == 'Foo-Bar'
Exemplo n.º 9
0
 def test_slugize_allows_underscore(self):
     assert slugize('foo_bar') == 'foo_bar'
Exemplo n.º 10
0
 def test_slugize_allows_period(self):
     assert slugize('foo.bar') == 'foo.bar'
Exemplo n.º 11
0
 def test_slugize_allows_underscore(self):
     assert slugize('foo_bar') == 'foo_bar'
Exemplo n.º 12
0
 def test_slugize_converts_space_to_dash(self):
     assert slugize('foo bar') == 'foo-bar'
Exemplo n.º 13
0
 def test_slugize_converts_comma_to_dash(self):
     assert slugize('foo,bar') == 'foo-bar'
Exemplo n.º 14
0
 def test_slugize_accepts_letter_in_middle(self):
     assert slugize('1a23') == '1a23'
Exemplo n.º 15
0
 def test_slugize_slugizes(self):
     assert slugize('Foo') == 'Foo'
Exemplo n.º 16
0
 def test_slugize_converts_comma_to_dash(self):
     assert slugize('foo,bar') == 'foo-bar'
Exemplo n.º 17
0
 def test_slugize_converts_space_to_dash(self):
     assert slugize('foo bar') == 'foo-bar'
Exemplo n.º 18
0
 def test_slugize_trims_whitespace(self):
     assert slugize('  Foo Bar  ') == 'Foo-Bar'
Exemplo n.º 19
0
 def test_slugize_allows_period(self):
     assert slugize('foo.bar') == 'foo.bar'
Exemplo n.º 20
0
 def test_slugize_trims_dashes(self):
     assert slugize('--Foo Bar--') == 'Foo-Bar'
Exemplo n.º 21
0
 def test_slugize_trims_dashes(self):
     assert slugize('--Foo Bar--') == 'Foo-Bar'
Exemplo n.º 22
0
 def test_slugize_trims_replacement_dashes(self):
     assert slugize(',,Foo Bar,,') == 'Foo-Bar'
Exemplo n.º 23
0
 def test_slugize_folds_dashes_together(self):
     assert slugize('1a----------------23') == '1a-23'
Exemplo n.º 24
0
 def test_slugize_folds_dashes_together(self):
     assert slugize('1a----------------23') == '1a-23'