Ejemplo n.º 1
0
def sender(session: Session) -> User:
    sender = create_model(
        session, User,
        username='******',
        password='******',
        email='*****@*****.**',
        language='english'
    )
    yield sender
    delete_instance(session, sender)
Ejemplo n.º 2
0
def user(session: Session) -> User:
    test_user = create_model(
        session, User,
        username='******',
        password='******',
        email='*****@*****.**',
        language='english'
    )
    yield test_user
    delete_instance(session, test_user)
Ejemplo n.º 3
0
def bad_user(session: Session) -> User:
    test_user = create_model(
        session,
        User,
        username='******',
        password='******',
        email='test.email#gmail.com',
    )
    yield test_user
    delete_instance(session, test_user)
Ejemplo n.º 4
0
def zodiac1(session: Session) -> Zodiac:
    zodiac = create_model(
        session, Zodiac,
        name="aries",
        start_month=3,
        start_day_in_month=20,
        end_month=4,
        end_day_in_month=19,
    )
    yield zodiac
    delete_instance(session, zodiac)
Ejemplo n.º 5
0
def invitation(event: Event, user: User, session: Session) -> Event:
    invitation = create_model(
        session,
        Invitation,
        creation=datetime.now(),
        recipient=user,
        event=event,
        event_id=event.id,
        recipient_id=user.id,
    )
    yield invitation
    delete_instance(session, invitation)
 def test_cleanup(self):
     tenant_id, auth_token = utils.keystone_login(
         common_config.TENANT_NAME, common_config.USER_NAME,
         common_config.PASS_WORD)
     for vm_name, image, flavor in common_config.vm_name_image_flavor:
         instance_id = utils.find_server_id(vm_name, tenant_id,
                                            auth_token)
         utils.delete_instance(instance_id, tenant_id, auth_token)
         content = utils.list_server(tenant_id, auth_token)
         if content["servers"] == []:
             LOG.info("Deleted all instances")
         else:
             LOG.error("Instances are not deleted successfully")
Ejemplo n.º 7
0
def add_quote(session: Session, id_quote: int, text: str,
              author: str) -> Quote:
    quote = create_model(session, Quote, id=id_quote, text=text, author=author)
    yield quote
    delete_instance(session, quote)
Ejemplo n.º 8
0
 def delete_instance(self, args):
     sys.stdout.write(
         str(
             utils.delete_instance(args.server_id, args.tenant_id,
                                   args.auth_token)))