Skip to content
Snippets Groups Projects
Verified Commit 29e4a9ab authored by Peter Stanko's avatar Peter Stanko
Browse files

Fixed tests and config renamed to source

parent 92a1c9cb
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -197,3 +197,18 @@ class UploadedEntity(object): ...@@ -197,3 +197,18 @@ class UploadedEntity(object):
self.filter() self.filter()
self.clean() self.clean()
return self.entity return self.entity
"""
{
"id" : "UUID",
"source":{
"type":"git"/"zip"
"path" : string OR
"url":url,
"branch":string,
"checkout":string
},
"whitelist": ""
}
"""
...@@ -7,6 +7,7 @@ log = logging.getLogger(__name__) ...@@ -7,6 +7,7 @@ log = logging.getLogger(__name__)
def filter_entity(entity): def filter_entity(entity):
filters = entity.filters.splitlines() filters = entity.filters.splitlines()
entity.files_path.mkdir(parents=True)
for pattern in filters: for pattern in filters:
log.info(f"[FLT] Filtering using filter: {pattern}") log.info(f"[FLT] Filtering using filter: {pattern}")
clone_files(src=entity.workspace, dst=entity.files_path, pattern=pattern) clone_files(src=entity.workspace, dst=entity.files_path, pattern=pattern)
......
...@@ -111,7 +111,7 @@ def clone_files(src: Path, dst: Path, pattern: str): ...@@ -111,7 +111,7 @@ def clone_files(src: Path, dst: Path, pattern: str):
log.debug(f"[CLN] Cloning files [{pattern}] : {src} -> {dst}") log.debug(f"[CLN] Cloning files [{pattern}] : {src} -> {dst}")
src = Path(src) src = Path(src)
dst = Path(dst) dst = Path(dst)
files = src.glob(pattern=pattern) files = src.rglob(pattern=pattern)
for fpath in files: for fpath in files:
clone_file(fpath, dst=dst, src=src) clone_file(fpath, dst=dst, src=src)
......
...@@ -15,7 +15,7 @@ def workspace(tmpdir): ...@@ -15,7 +15,7 @@ def workspace(tmpdir):
@pytest.fixture @pytest.fixture
def git_config(): def git_config():
return dict( return dict(
repo='https://github.com/pestanko/example-repo', url='https://github.com/pestanko/example-repo',
branch='master' branch='master'
) )
...@@ -29,7 +29,7 @@ def submission(): ...@@ -29,7 +29,7 @@ def submission():
def uploaded_entity(submission, workspace, git_config): def uploaded_entity(submission, workspace, git_config):
return UploadedEntity( return UploadedEntity(
entity=submission, entity=submission,
config=git_config, source=git_config,
workspace=workspace.mkdir('repo') workspace=workspace.mkdir('repo')
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment