class VersionCheckerTest(test_helper.MoxTestCase):
    def setUp(self):
        super(VersionCheckerTest, self).setUp()
        self.fp = FakePackage()
        self.facter = self._create_mock_facter('Debian')
        self.setUpChecker()

    def setUpChecker(self):
        self.vchecker = VersionChecker(self.facter)

    def test_analyze_version_without_sources_returns_true(self):
        v = VersionAdapter(FakeVersion._create('1.2.3', []))
        self.assert_(self.vchecker.analyze(v))

    def test_analyze_version_only_in_dpkg_status_file_returns_true(self):
        v = VersionAdapter(FakeVersion._create('1.2.3', ['dpkg']))
        self.assert_(self.vchecker.analyze(v))

    def test_analyze_version_in_dpkg_status_file_and_unofficial_source_returns_true(
            self):
        v = VersionAdapter(FakeVersion._create('1.2.3', ['dpkg', 'NonDebian']))
        self.assert_(self.vchecker.analyze(v))

    def test_analyze_version_in_dpkg_status_file_and_official_source_returns_false(
            self):
        v = VersionAdapter(FakeVersion._create('1.2.3', ['dpkg', 'Debian']))
        self.assert_(not self.vchecker.analyze(v))

    def test_analyze_version_in_dpkg_status_file_and_both_official_and_unofficial_source_returns_false(
            self):
        v = VersionAdapter(
            FakeVersion._create('1.2.3', ['dpkg', 'Debian', 'NonDebian']))
        self.assert_(not self.vchecker.analyze(v))
class VersionCheckerTest(test_helper.MoxTestCase):
	def setUp(self):
		super(VersionCheckerTest, self).setUp()
		self.fp = FakePackage()
		self.facter = self._create_mock_facter('Debian')
		self.setUpChecker()
	def setUpChecker(self):
		self.vchecker = VersionChecker(self.facter)
	def test_analyze_version_without_sources_returns_true(self):
		v = VersionAdapter(FakeVersion._create('1.2.3', []))
		self.assert_(self.vchecker.analyze(v))
	def test_analyze_version_only_in_dpkg_status_file_returns_true(self):
		v = VersionAdapter(FakeVersion._create('1.2.3', ['dpkg']))
		self.assert_(self.vchecker.analyze(v))
	def test_analyze_version_in_dpkg_status_file_and_unofficial_source_returns_true(self):
		v = VersionAdapter(FakeVersion._create('1.2.3', ['dpkg', 'NonDebian']))
		self.assert_(self.vchecker.analyze(v))
	def test_analyze_version_in_dpkg_status_file_and_official_source_returns_false(self):
		v = VersionAdapter(FakeVersion._create('1.2.3', ['dpkg', 'Debian']))
		self.assert_(not self.vchecker.analyze(v))
	def test_analyze_version_in_dpkg_status_file_and_both_official_and_unofficial_source_returns_false(self):
		v = VersionAdapter(FakeVersion._create('1.2.3', ['dpkg', 'Debian', 'NonDebian']))
		self.assert_(not self.vchecker.analyze(v))
 def setUpChecker(self):
     self.vchecker = VersionChecker(self.facter)
	def setUpChecker(self):
		self.vchecker = VersionChecker(self.facter)