def test_run_wrong_ace_format(self, mock_eng, mock_boot, mock_parse):
     obj = CountACECommand()
     obj.options = Mock(ace="asdasdasdasd", models="User,Story")
     with pytest.raises(ValueError) as ex:
         obj.run()
     assert "--ace" in str(ex.value)
     mock_eng.get_document_cls.assert_has_calls([call("User"), call("Story")])
Beispiel #2
0
 def test_run_wrong_ace_format(self, mock_eng, mock_boot, mock_parse):
     obj = CountACECommand()
     obj.options = Mock(ace='asdasdasdasd', models='User,Story')
     with pytest.raises(ValueError) as ex:
         obj.run()
     assert '--ace' in str(ex.value)
     mock_eng.get_document_cls.assert_has_calls(
         [call('User'), call('Story')])
 def test_run(self, mock_six, mock_count, mock_eng, mock_boot, mock_parse):
     obj = CountACECommand()
     obj.options = Mock(ace="{}", models="User")
     model = Mock(__name__="Foo")
     mock_eng.get_document_cls.return_value = model
     mock_count.return_value = {model: 123}
     obj.run()
     mock_six.print_.assert_has_calls([call("Model,Count"), call("Foo,123")])
     mock_count.assert_called_once_with(ace={}, models=[model])
Beispiel #4
0
 def test_run_none_count(self, mock_six, mock_count, mock_boot, mock_parse):
     obj = CountACECommand()
     obj.options = Mock(ace='{}', models='')
     mock_count.return_value = {Mock(__name__='Foo'): None}
     obj.run()
     mock_six.print_.assert_has_calls([
         call('Model,Count'),
         call('Foo,Not es-based'),
     ])
Beispiel #5
0
 def test_run(self, mock_six, mock_count, mock_eng, mock_boot, mock_parse):
     obj = CountACECommand()
     obj.options = Mock(ace='{}', models='User')
     model = Mock(__name__='Foo')
     mock_eng.get_document_cls.return_value = model
     mock_count.return_value = {model: 123}
     obj.run()
     mock_six.print_.assert_has_calls([
         call('Model,Count'),
         call('Foo,123'),
     ])
     mock_count.assert_called_once_with(ace={}, models=[model])
 def test_run_none_count(self, mock_six, mock_count, mock_boot, mock_parse):
     obj = CountACECommand()
     obj.options = Mock(ace="{}", models="")
     mock_count.return_value = {Mock(__name__="Foo"): None}
     obj.run()
     mock_six.print_.assert_has_calls([call("Model,Count"), call("Foo,Not es-based")])
 def test_run_no_models(self, mock_count, mock_boot, mock_parse):
     obj = CountACECommand()
     obj.options = Mock(ace="{}", models=None)
     mock_count.return_value = {Mock(__name__="Foo"): 1}
     obj.run()
     mock_count.assert_called_once_with(ace={}, models=None)
Beispiel #8
0
 def test_run_no_models(self, mock_count, mock_boot, mock_parse):
     obj = CountACECommand()
     obj.options = Mock(ace='{}', models=None)
     mock_count.return_value = {Mock(__name__='Foo'): 1}
     obj.run()
     mock_count.assert_called_once_with(ace={}, models=None)