def test_export_file_already_exists_with_override_false(self, patches):
            patches.path_exists.return_value = True

            with pytest.raises(ModelArchiverError):
                ModelExportUtils.check_mar_already_exists('some-model', None, False)

            patches.path_exists.assert_called_once_with('/Users/dummyUser/some-model.mar')
        def test_export_file_already_exists_with_override(self, patches):
            patches.path_exists.return_value = True

            ModelExportUtils.check_mar_already_exists('some-model', None, True)

            patches.path_exists.assert_called_once_with(
                '/Users/dummyUser/some-model.mar')
        def test_export_file_is_not_none(self, patches):
            patches.path_exists.return_value = False
            ModelExportUtils.check_mar_already_exists('some-model',
                                                      '/Users/Piyush/', False)

            patches.path_exists.assert_called_once_with(
                '/Users/Piyush/some-model.mar')
        def test_export_file_is_none_tar(self, patches):
            patches.path_exists.return_value = False
            ret_val = ModelExportUtils.check_mar_already_exists(
                'some-model', None, False, archive_format='tgz')

            patches.path_exists.assert_called_once_with(
                "/Users/dummyUser/some-model.tar.gz")
            assert ret_val == "/Users/dummyUser"
        def test_export_file_is_none(self, patches):
            patches.path_exists.return_value = False
            ret_val = ModelExportUtils.check_mar_already_exists(
                'some-model', None, False)

            patches.path_exists.assert_called_once_with(
                "/Users/dummyUser/some-model.mar")
            assert ret_val == "/Users/dummyUser"
Ejemplo n.º 6
0
 def test_export_file_already_exists_with_override_false(self, patches):
     patches.path_exists.return_value = True
     with pytest.raises(ModelArchiverError):
         ModelExportUtils.check_mar_already_exists(
             'some-model', None, False)
     _validate_mar(patches)
Ejemplo n.º 7
0
 def test_export_file_already_exists_with_override(self, patches):
     patches.path_exists.return_value = True
     ModelExportUtils.check_mar_already_exists('some-model', None, True)
     _validate_mar(patches)
Ejemplo n.º 8
0
 def test_export_file_is_none(self, patches):
     patches.path_exists.return_value = False
     ret_val = ModelExportUtils.check_mar_already_exists(
         'some-model', None, False)
     _validate_mar(patches)
     assert ret_val == "/Users/dummyUser"