Skip to content

Commit

Permalink
Add test for make_codebase_resource #180
Browse files Browse the repository at this point in the history
    * Have test to ensure that the codebase prefix is present when relative_to_work_path is True

Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed Dec 8, 2021
1 parent d801565 commit a4d4a8b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions scanpipe/tests/test_pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,3 +1183,22 @@ def test_scanpipe_pipes_make_codebase_resource(self):
make_codebase_resource(p1, resource_location)
self.assertEqual(1, p1.codebaseresources.count())
self.assertEqual(0, p1.projecterrors.count())

def test_scanpipe_pipes_make_codebase_resource_relative_to_work_path(self):
# Create test Project
p1 = Project.objects.create(name="Analysis")

# Create test CodebaseResource
test_resource_location = str(self.data_location / "notice.NOTICE")
copy_input(test_resource_location, p1.codebase_path)
resource_codebase_location = str(p1.codebase_path / "notice.NOTICE")
make_codebase_resource(
p1, resource_codebase_location, relative_to_work_path=True
)

# Ensure test CodebaseResource exists and that we only have one of them
self.assertEqual(1, p1.codebaseresources.count())

# Check to see if our test CodebaseResource has the `codebase` prefix in its name
cb = p1.codebaseresources.all()[0]
self.assertEqual("codebase/notice.NOTICE", cb.path)

0 comments on commit a4d4a8b

Please sign in to comment.