import pytest
from zfssnap import Host, Dataset
import subprocess


PROPERTY_PREFIX = 'zfssnap'


class TestDataset(object):
    @pytest.fixture
    def fs(self):
        fs_name = 'zpool/dataset'
        host = Host()
        return Dataset(host, fs_name)

    @pytest.fixture
    def ssh_fs(self):
        ssh_user = 'root'
        ssh_host = 'host'
        fs_name = 'zpool/dataset'
        host = Host(ssh_user=ssh_user, ssh_host=ssh_host)
        return Dataset(host, fs_name)

    def test_autoconvert_to_int(self):
        assert isinstance(Dataset._autoconvert('123'), int)

    def test_autoconvert_to_str(self):
        assert isinstance(Dataset._autoconvert('12f'), str)

    def test_return_local_location(self, fs):
        assert fs.location == 'zpool/dataset'

    def test_return_ssh_location(self, ssh_fs):
        assert ssh_fs.location == 'root@host:zpool/dataset'
import pytest
from zfssnap import autotype, Host, Dataset
import subprocess


PROPERTY_PREFIX = 'zfssnap'


class TestDataset(object):
    @pytest.fixture
    def fs(self):
        fs_name = 'zpool/dataset'
        host = Host()
        return Dataset(host, fs_name)

    @pytest.fixture
    def ssh_fs(self):
        ssh_user = 'root'
        ssh_host = 'host'
        fs_name = 'zpool/dataset'
        host = Host(ssh_user=ssh_user, ssh_host=ssh_host)
        return Dataset(host, fs_name)

    def test_autotype_to_int(self):
        assert isinstance(autotype('123'), int)

    def test_autotype_to_str(self):
        assert isinstance(autotype('12f'), str)

    def test_return_local_location(self, fs):
        assert fs.location == 'zpool/dataset'

    def test_return_ssh_location(self, ssh_fs):
        assert ssh_fs.location == 'root@host:zpool/dataset'
Fix broken tests after moving _autoconvert to autotype
Fix broken tests after moving _autoconvert to autotype

  import pytest
- from zfssnap import Host, Dataset
+ from zfssnap import autotype, Host, Dataset
  import subprocess
  
  
  PROPERTY_PREFIX = 'zfssnap'
  
  
  class TestDataset(object):
      @pytest.fixture
      def fs(self):
          fs_name = 'zpool/dataset'
          host = Host()
          return Dataset(host, fs_name)
  
      @pytest.fixture
      def ssh_fs(self):
          ssh_user = 'root'
          ssh_host = 'host'
          fs_name = 'zpool/dataset'
          host = Host(ssh_user=ssh_user, ssh_host=ssh_host)
          return Dataset(host, fs_name)
  
-     def test_autoconvert_to_int(self):
+     def test_autotype_to_int(self):
-         assert isinstance(Dataset._autoconvert('123'), int)
+         assert isinstance(autotype('123'), int)
  
-     def test_autoconvert_to_str(self):
+     def test_autotype_to_str(self):
-         assert isinstance(Dataset._autoconvert('12f'), str)
+         assert isinstance(autotype('12f'), str)
  
      def test_return_local_location(self, fs):
          assert fs.location == 'zpool/dataset'
  
      def test_return_ssh_location(self, ssh_fs):
          assert ssh_fs.location == 'root@host:zpool/dataset'
Fix broken tests after moving _autoconvert to autotype
## Code Before:
import pytest
from zfssnap import Host, Dataset
import subprocess


PROPERTY_PREFIX = 'zfssnap'


class TestDataset(object):
    @pytest.fixture
    def fs(self):
        fs_name = 'zpool/dataset'
        host = Host()
        return Dataset(host, fs_name)

    @pytest.fixture
    def ssh_fs(self):
        ssh_user = 'root'
        ssh_host = 'host'
        fs_name = 'zpool/dataset'
        host = Host(ssh_user=ssh_user, ssh_host=ssh_host)
        return Dataset(host, fs_name)

    def test_autoconvert_to_int(self):
        assert isinstance(Dataset._autoconvert('123'), int)

    def test_autoconvert_to_str(self):
        assert isinstance(Dataset._autoconvert('12f'), str)

    def test_return_local_location(self, fs):
        assert fs.location == 'zpool/dataset'

    def test_return_ssh_location(self, ssh_fs):
        assert ssh_fs.location == 'root@host:zpool/dataset'
## Instruction:
Fix broken tests after moving _autoconvert to autotype
## Code After:
import pytest
from zfssnap import autotype, Host, Dataset
import subprocess


PROPERTY_PREFIX = 'zfssnap'


class TestDataset(object):
    @pytest.fixture
    def fs(self):
        fs_name = 'zpool/dataset'
        host = Host()
        return Dataset(host, fs_name)

    @pytest.fixture
    def ssh_fs(self):
        ssh_user = 'root'
        ssh_host = 'host'
        fs_name = 'zpool/dataset'
        host = Host(ssh_user=ssh_user, ssh_host=ssh_host)
        return Dataset(host, fs_name)

    def test_autotype_to_int(self):
        assert isinstance(autotype('123'), int)

    def test_autotype_to_str(self):
        assert isinstance(autotype('12f'), str)

    def test_return_local_location(self, fs):
        assert fs.location == 'zpool/dataset'

    def test_return_ssh_location(self, ssh_fs):
        assert ssh_fs.location == 'root@host:zpool/dataset'