Beispiel #1
0
 def test_valid_format(self, controler, controler_with_logging, tmpdir, mocker):
     """Make sure that a valid format returns the apropiate writer class."""
     path = os.path.join(tmpdir.mkdir('report').strpath, 'report.csv')
     hamsterlib.reports.TSVWriter = mocker.MagicMock(return_value=hamsterlib.reports.TSVWriter(
         path))
     hamster_cli._export(controler, 'csv', None, None)
     assert hamsterlib.reports.TSVWriter.called
 def test_with_end(self, controler, controler_with_logging, tmpdir, mocker):
     """Make sure that passing a end date is passed to the fact gathering method."""
     controler.facts.get_all = mocker.MagicMock()
     path = os.path.join(tmpdir.mkdir('report').strpath, 'report.csv')
     hamsterlib.reports.TSVWriter = mocker.MagicMock(
         return_value=hamsterlib.reports.TSVWriter(path))
     end = fauxfactory.gen_datetime()
     hamster_cli._export(controler, 'csv', None, end)
     args, kwargs = controler.facts.get_all.call_args
     assert kwargs['end'] == end
Beispiel #3
0
 def test_with_end(self, controler, controler_with_logging, tmpdir, mocker):
     """Make sure that passing a end date is passed to the fact gathering method."""
     controler.facts.get_all = mocker.MagicMock()
     path = os.path.join(tmpdir.mkdir('report').strpath, 'report.csv')
     hamsterlib.reports.TSVWriter = mocker.MagicMock(return_value=hamsterlib.reports.TSVWriter(
         path))
     end = fauxfactory.gen_datetime()
     hamster_cli._export(controler, 'csv', None, end)
     args, kwargs = controler.facts.get_all.call_args
     assert kwargs['end'] == end
Beispiel #4
0
 def test_invalid_format(self, controler_with_logging, format, mocker):
     """Make sure that passing an invalid format exits prematurely."""
     controler = controler_with_logging
     hamster_cli.sys.exit = mocker.MagicMock()
     hamster_cli._export(controler, format, None, None)
     assert hamster_cli.sys.exit.called
 def test_xml(self, controler, controler_with_logging, mocker):
     """Make sure that passing 'xml' as format parameter returns the apropiate writer class."""
     hamsterlib.reports.XMLWriter = mocker.MagicMock()
     hamster_cli._export(controler, 'xml', None, None)
     assert hamsterlib.reports.XMLWriter.called
 def test_ical(self, controler, controler_with_logging, mocker):
     """Make sure that a valid format returns the apropiate writer class."""
     hamsterlib.reports.ICALWriter = mocker.MagicMock()
     hamster_cli._export(controler, 'ical', None, None)
     assert hamsterlib.reports.ICALWriter.called
 def test_invalid_format(self, controler_with_logging, format, mocker):
     """Make sure that passing an invalid format exits prematurely."""
     controler = controler_with_logging
     with pytest.raises(ClickException):
         hamster_cli._export(controler, format, None, None)
Beispiel #8
0
 def test_xml(self, controler, controler_with_logging, mocker):
     """Make sure that passing 'xml' as format parameter returns the apropiate writer class."""
     hamsterlib.reports.XMLWriter = mocker.MagicMock()
     hamster_cli._export(controler, 'xml', None, None)
     assert hamsterlib.reports.XMLWriter.called
Beispiel #9
0
 def test_ical(self, controler, controler_with_logging, mocker):
     """Make sure that a valid format returns the apropiate writer class."""
     hamsterlib.reports.ICALWriter = mocker.MagicMock()
     hamster_cli._export(controler, 'ical', None, None)
     assert hamsterlib.reports.ICALWriter.called
Beispiel #10
0
 def test_invalid_format(self, controler_with_logging, format, mocker):
     """Make sure that passing an invalid format exits prematurely."""
     controler = controler_with_logging
     with pytest.raises(ClickException):
         hamster_cli._export(controler, format, None, None)