Skip to content

Commit

Permalink
adds 'popper dot' test (#810)
Browse files Browse the repository at this point in the history
* Adds 'dot' test

* Variable Rename

* Removed scaffold and dot CI test
  • Loading branch information
vipulchhabra99 committed Apr 22, 2020
1 parent 5ed10c1 commit c0a62ea
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 61 deletions.
4 changes: 0 additions & 4 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ echo "reuse"
echo "###################################"
ci/test/validate
echo "###################################"
ci/test/scaffold
echo "###################################"
ci/test/dry-run
echo "###################################"
# ci/test/parallel
echo "###################################"
ci/test/dot
echo "###################################"
ci/test/interrupt
echo "###################################"
ci/test/quiet
Expand Down
43 changes: 0 additions & 43 deletions ci/test/dot

This file was deleted.

14 changes: 0 additions & 14 deletions ci/test/scaffold

This file was deleted.

43 changes: 43 additions & 0 deletions cli/test/test_cmddot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
from click.testing import CliRunner

import popper.commands.cmd_dot as dot
import popper.commands.cmd_run as run
from test_common import PopperTest
from popper.parser import Workflow, YMLWorkflow, HCLWorkflow

import unittest
import os
import tempfile
import git


class TestDot(PopperTest):

def test_dot(self):

wf_dir = tempfile.mkdtemp()
runner = CliRunner()
git.Git(wf_dir).clone(
"https://github.com/popperized/github-actions-demo.git")

workflow_path = f'{wf_dir}/github-actions-demo/.github/main.workflow'

with self.assertLogs('popper') as test_logger:

result = runner.invoke(dot.cli, ['-f', workflow_path])
self.assertEqual(result.exit_code, 0)
log_output = test_logger.output[0]
self.assertTrue('"branch-filter" -> "deploy";' in log_output)
self.assertTrue('"install" -> "lint";' in log_output)
self.assertTrue('"install" -> "test";' in log_output)
self.assertTrue('"lint" -> "branch-filter";' in log_output)
self.assertTrue('"test-and-deploy" -> "install";' in log_output)
self.assertTrue('"test" -> "branch-filter"' in log_output)
self.assertFalse('fillcolor=transparent,color=' in log_output)

with self.assertLogs('popper') as test_logger:

result = runner.invoke(dot.cli, ['--colors', '-f', workflow_path])
self.assertEqual(result.exit_code, 0)
self.assertTrue(
'fillcolor=transparent,color=' in test_logger.output[0])

0 comments on commit c0a62ea

Please sign in to comment.