示例#1
0
def new_multiple_companies(app):
    companies = []
    for each in range(3):
        params = {'name': fake.company()}
        company = Company(**params)
        companies.append(company.save())
    return companies
示例#2
0
 def test_save(self, init_db):
     """Test for creating a new company
     
         Args:
             init_db(SQLAlchemy): fixture to initialize the test database
     """
     params = {'name': fake.company()}
     company = Company(**params)
     assert company == company.save()
示例#3
0
 def test_update(self, init_db, new_company):
     """Test for update method
     
         Args:
             init_db(SQLAlchemy): fixture to initialize the test database
             new_company (Company): Fixture to create a new company
     """
     company_name = fake.company()
     new_company.update(name=company_name)
     assert new_company.name == company_name
 def test_endpoint_is_required(self):
     with assert_raises(IntegrityError):
         ConferenceFactory(endpoint=None, name=fake.company()).save()
示例#5
0
 def test_endpoint_and_name_are_required(self):
     with assert_raises(ValidationError):
         ConferenceFactory(endpoint=None, name=fake.company()).save()
     with assert_raises(ValidationError):
         ConferenceFactory(endpoint='spsp2014', name=None).save()
示例#6
0
 def test_endpoint_and_name_are_required(self):
     with assert_raises(ValidationError):
         ConferenceFactory(endpoint=None, name=fake.company()).save()
     with assert_raises(ValidationError):
         ConferenceFactory(endpoint='spsp2014', name=None).save()
示例#7
0
 def test_endpoint_is_required(self):
     with assert_raises(IntegrityError):
         ConferenceFactory(endpoint=None, name=fake.company()).save()
示例#8
0
def new_company(app):
    params = {
        'name': fake.company(),
    }
    company = Company(**params)
    return company.save()