예제 #1
0
def test_add_and_delete_transfer_from_file(core_org, context):
    """
    <b>Description:</b>
    Checks if a file can be uploaded from disk to the platform.

    <b>Input data:</b>
    1. File name.
    2. Transfer title.
    3. Transfer category.

    <b>Expected results:</b>
    Test passes when a file from disk was uploaded to the platform and corresponding transfer and dataset were
    successfully created and removed from the platform.

    <b>Steps:</b>
    1. Create a transfer using generated csv file.
    2. Check if transfer finished with correct state and verify that it is present on the transfers list.
    3. Check if the transfer has corresponding dataset.
    4. Delete dataset and transfer from the platform.
    5. Verify that transfer and dataset were removed from the platform.
    """
    step("Generate a test csv file")
    file_path = generate_csv_file(column_count=10, row_count=100)
    step("Create a transfer by file upload")
    transfer = Transfer.api_create_by_file_upload(context,
                                                  category="health",
                                                  org_guid=core_org.guid,
                                                  file_path=file_path)
    transfer_flow(transfer, core_org)
예제 #2
0
def test_add_and_delete_transfer_from_file(core_org, context):
    """Create and Delete Transfer from File"""
    step("Generate a test csv file")
    file_path = generate_csv_file(column_count=10, row_count=100)
    step("Create a transfer by file upload")
    transfer = Transfer.api_create_by_file_upload(context,
                                                  category="health",
                                                  org_guid=core_org.guid,
                                                  file_path=file_path)
    transfer_flow(transfer, core_org)
예제 #3
0
 def _create_transfer(self,
                      context,
                      org_guid,
                      column_count=10,
                      row_count=10,
                      category=TestSubmitTransfer.DEFAULT_CATEGORY,
                      size=None,
                      file_name=None):
     step("Generate sample csv file")
     file_path = generate_csv_file(column_count=column_count,
                                   row_count=row_count,
                                   size=size,
                                   file_name=file_name)
     step("Create a transfer with new category")
     transfer = Transfer.api_create_by_file_upload(context,
                                                   category=category,
                                                   org_guid=org_guid,
                                                   file_path=file_path)
     transfer.ensure_finished()
     return transfer
예제 #4
0
    def test_add_user(self, test_org, context):
        """ Verify if user data are properly saved in HDFS while creating user and uploading data file to TAP.

            After create user test verifies that user is synchronized. Then login to platform as new user.
            Create transfer to HDFS and check that transfer is completed.

            Input data:
                user name: name for new user
                data file: file which is transferred to HDFS
                organization: organization wherein will be new user

            Expected results:
               It is possible to create new user and login to platform as new user. New user is able to create
               transfer to HDFS. User data are properly saved on HDFS.

            Steps:
                1. Create new user
                2. Check that user is created completely
                3. Login as new registered user
                4. Check that the user is able to create a transfer
                5. Ensure that transfer is completed successfully
        """
        step("Create new user")
        user = User.create_by_adding_to_organization(
            context=context,
            org_guid=test_org.guid,
            role=User.ORG_ROLE["user"])
        step("Check that user was synchronized")
        ag_user = AuthGatewayUser.get_user_state(org_guid=test_org.guid,
                                                 user_id=user.guid)
        assert ag_user.is_synchronized, "User {} was not synchronized".format(
            user.username)
        step("Login new registered user")
        client = user.login()
        step("Check that the user is able to create a transfer")
        transfer = Transfer.api_create_by_file_upload(
            context,
            test_org.guid,
            file_utils.generate_csv_file(),
            client=client)
        transfer.ensure_finished()