def upload_assets(auth, config):
    """
    Uploads a specified collection of assets either from a set created
    from scratch, or from the contents of existing directory.
    
    :Args:
        - auth (:class:`.Credentials`): instance of the Credentials class
          as returned by authentication()
        - config (:class:`.Configuration`): instance of the Configuration
          class as returned by logging_mode()
    """
    asset_mgr = FileManager(auth, cfg=config)
    asset_to_add = asset_mgr.file_from_path(ASSET)

    # Creates FileCollection object
    asset_set = asset_mgr.create_file_set(asset_to_add)

    # Extends a FileCollection object with another FileCollection
    asset_set.extend(asset_mgr.files_from_dir(ASSET_DIR))

    try:
        # force=true uploads the assets in the asset collection regardless of
        # whether they have been uploaded before.
        asset_set.upload(force=True)
        print("Assets uploaded successfully.")

    except RestCallException as e:
        print("failed: {0}".format(e))
    def test_filemgr_create_file_set(self, mock_file, mock_api, mock_creds,
                                     mock_cfg):
        """Test create_file_set"""

        mgr = FileManager(mock_creds, cfg=mock_cfg)
        coll = mgr.create_file_set()
        self.assertIsNotNone(coll)
        mock_file.assert_called_with(mock.ANY, *[])

        coll = mgr.create_file_set(None)
        mock_file.assert_called_with(mock.ANY, *[None])

        coll = mgr.create_file_set(1, 2, 3)
        mock_file.assert_called_with(mock.ANY, *[1, 2, 3])

        coll = mgr.create_file_set("a", "a", "a")
        mock_file.assert_called_with(mock.ANY, *['a'])
    def test_filemgr_create_file_set(self,
                                     mock_file,
                                     mock_api,
                                     mock_creds,
                                     mock_cfg):
        """Test create_file_set"""

        mgr = FileManager(mock_creds, cfg=mock_cfg)
        coll = mgr.create_file_set()
        self.assertIsNotNone(coll)
        mock_file.assert_called_with(mock.ANY, *[])

        coll = mgr.create_file_set(None)
        mock_file.assert_called_with(mock.ANY, *[None])

        coll = mgr.create_file_set(1, 2, 3)
        mock_file.assert_called_with(mock.ANY, *[1, 2, 3])

        coll = mgr.create_file_set("a", "a", "a")
        mock_file.assert_called_with(mock.ANY, *['a'])