class TestFoodcritic(TestCase): needs_critic = skipIf(critic_missing, 'Missing foodcritic, cannot run') fixtures = [ 'tests/fixtures/foodcritic/noerrors', 'tests/fixtures/foodcritic/errors', ] def setUp(self): self.problems = Problems() @needs_critic def test_process_cookbook_pass(self): self.tool = Foodcritic(self.problems, None, self.fixtures[0]) self.tool.process_files(None) eq_([], self.problems.all()) @needs_critic def test_process_cookbook_fail(self): self.tool = Foodcritic(self.problems, None, self.fixtures[1]) self.tool.process_files(None) problems = self.problems.all() eq_(5, len(problems)) expected = Comment( 'tests/fixtures/foodcritic/errors/recipes/apache2.rb', 1, 1, 'FC007: Ensure recipe dependencies are reflected in cookbook ' 'metadata') eq_(expected, problems[1])
def test_process_cookbook_fail(self): self.tool = Foodcritic(self.problems, None, self.fixtures[1]) self.tool.process_files(None) problems = self.problems.all() eq_(5, len(problems)) expected = Comment( 'tests/fixtures/foodcritic/errors/recipes/apache2.rb', 1, 1, 'FC007: Ensure recipe dependencies are reflected in cookbook ' 'metadata') eq_(expected, problems[1])
class TestFoodcritic(TestCase): fixtures = [ 'tests/fixtures/foodcritic/noerrors', 'tests/fixtures/foodcritic/errors', ] def setUp(self): self.problems = Problems() def test_version(self): self.tool = Foodcritic(self.problems, {}, root_dir) assert self.tool.version != '' @requires_image('ruby2') def test_process_cookbook_pass__no_path(self): self.tool = Foodcritic(self.problems, {}, os.path.join(root_dir, self.fixtures[0])) self.tool.process_files(None) self.assertEqual([], self.problems.all()) @requires_image('ruby2') def test_process_cookbook_pass(self): self.tool = Foodcritic(self.problems, {'path': self.fixtures[0]}, root_dir) self.tool.process_files(None) self.assertEqual([], self.problems.all()) @requires_image('ruby2') def test_process_cookbook_fail(self): self.tool = Foodcritic(self.problems, {'path': self.fixtures[1]}, root_dir) self.tool.process_files(None) problems = self.problems.all() self.assertEqual(5, len(problems)) expected = Comment( 'tests/fixtures/foodcritic/errors/recipes/apache2.rb', 1, 1, 'FC007: Ensure recipe dependencies are reflected in cookbook ' 'metadata') self.assertEqual(expected, problems[1])
class TestFoodcritic(TestCase): fixtures = [ 'tests/fixtures/foodcritic/noerrors', 'tests/fixtures/foodcritic/errors', ] def setUp(self): self.problems = Problems() @requires_image('ruby2') def test_process_cookbook_pass__no_path(self): self.tool = Foodcritic(self.problems, {}, os.path.join(root_dir, self.fixtures[0])) self.tool.process_files(None) self.assertEqual([], self.problems.all()) @requires_image('ruby2') def test_process_cookbook_pass(self): self.tool = Foodcritic(self.problems, {'path': self.fixtures[0]}, root_dir) self.tool.process_files(None) self.assertEqual([], self.problems.all()) @requires_image('ruby2') def test_process_cookbook_fail(self): self.tool = Foodcritic(self.problems, {'path': self.fixtures[1]}, root_dir) self.tool.process_files(None) problems = self.problems.all() self.assertEqual(5, len(problems)) expected = Comment( 'tests/fixtures/foodcritic/errors/recipes/apache2.rb', 1, 1, 'FC007: Ensure recipe dependencies are reflected in cookbook ' 'metadata') self.assertEqual(expected, problems[1])
def test_process_cookbook_pass(self): self.tool = Foodcritic(self.problems, {'path': self.fixtures[0]}, root_dir) self.tool.process_files(None) eq_([], self.problems.all())
def test_process_cookbook_pass__no_path(self): self.tool = Foodcritic(self.problems, {}, os.path.join(root_dir, self.fixtures[0])) self.tool.process_files(None) eq_([], self.problems.all())
def test_version(self): self.tool = Foodcritic(self.problems, {}, root_dir) assert self.tool.version != ''
def test_process_cookbook_pass(self): self.tool = Foodcritic(self.problems, {'path': self.fixtures[0]}, root_dir) self.tool.process_files(None) self.assertEqual([], self.problems.all())
def test_process_cookbook_pass__no_path(self): self.tool = Foodcritic(self.problems, {}, os.path.join(root_dir, self.fixtures[0])) self.tool.process_files(None) self.assertEqual([], self.problems.all())
def test_process_cookbook_pass(self): self.tool = Foodcritic(self.problems, None, self.fixtures[0]) self.tool.process_files(None) eq_([], self.problems.all())