Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #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)
Beispiel #5
0
 def test_slugize_accepts_letter_in_middle(self):
     assert slugize('1a23') == '1a23'
Beispiel #6
0
 def test_slugize_slugizes(self):
     assert slugize('Foo') == 'Foo'
Beispiel #7
0
 def test_slugize_trims_replacement_dashes(self):
     assert slugize(',,Foo Bar,,') == 'Foo-Bar'
Beispiel #8
0
 def test_slugize_trims_whitespace(self):
     assert slugize('  Foo Bar  ') == 'Foo-Bar'
Beispiel #9
0
 def test_slugize_allows_underscore(self):
     assert slugize('foo_bar') == 'foo_bar'
Beispiel #10
0
 def test_slugize_allows_period(self):
     assert slugize('foo.bar') == 'foo.bar'
Beispiel #11
0
 def test_slugize_allows_underscore(self):
     assert slugize('foo_bar') == 'foo_bar'
Beispiel #12
0
 def test_slugize_converts_space_to_dash(self):
     assert slugize('foo bar') == 'foo-bar'
Beispiel #13
0
 def test_slugize_converts_comma_to_dash(self):
     assert slugize('foo,bar') == 'foo-bar'
Beispiel #14
0
 def test_slugize_accepts_letter_in_middle(self):
     assert slugize('1a23') == '1a23'
Beispiel #15
0
 def test_slugize_slugizes(self):
     assert slugize('Foo') == 'Foo'
Beispiel #16
0
 def test_slugize_converts_comma_to_dash(self):
     assert slugize('foo,bar') == 'foo-bar'
Beispiel #17
0
 def test_slugize_converts_space_to_dash(self):
     assert slugize('foo bar') == 'foo-bar'
Beispiel #18
0
 def test_slugize_trims_whitespace(self):
     assert slugize('  Foo Bar  ') == 'Foo-Bar'
Beispiel #19
0
 def test_slugize_allows_period(self):
     assert slugize('foo.bar') == 'foo.bar'
Beispiel #20
0
 def test_slugize_trims_dashes(self):
     assert slugize('--Foo Bar--') == 'Foo-Bar'
Beispiel #21
0
 def test_slugize_trims_dashes(self):
     assert slugize('--Foo Bar--') == 'Foo-Bar'
Beispiel #22
0
 def test_slugize_trims_replacement_dashes(self):
     assert slugize(',,Foo Bar,,') == 'Foo-Bar'
Beispiel #23
0
 def test_slugize_folds_dashes_together(self):
     assert slugize('1a----------------23') == '1a-23'
Beispiel #24
0
 def test_slugize_folds_dashes_together(self):
     assert slugize('1a----------------23') == '1a-23'