def test_enabled(self): c = Content(content_type="yum", name="mycontent", label="mycontent", enabled=None) self.assertTrue(c.enabled) c = Content(content_type="yum", name="mycontent", label="mycontent", enabled="1") self.assertTrue(c.enabled) c = Content(content_type="yum", name="mycontent", label="mycontent", enabled=True) self.assertTrue(c.enabled) c = Content(content_type="yum", name="mycontent", label="mycontent", enabled="0") self.assertFalse(c.enabled) self.assertRaises(CertificateException, Content, content_type="yum", name="mycontent", label="mycontent", enabled="5")
def test_arches_not_set(self): c = Content(content_type="yum", name="mycontent", label="mycontent", enabled=1) self.assertTrue(isinstance(c.arches, list)) self.assertEqual([], c.arches)
def test_arches_all(self): c = Content(content_type="yum", name="mycontent", label="mycontent", enabled=1, arches=['ALL']) self.assertTrue(isinstance(c.arches, list)) self.assertTrue('ALL' in c.arches)
def test_arches(self): c = Content(content_type="yum", name="mycontent", label="mycontent", enabled=1, arches=['i386', 's390']) self.assertTrue(isinstance(c.arches, list)) self.assertTrue('i386' in c.arches) self.assertTrue('s390' in c.arches)
def test_arches(self): c = Content(content_type="yum", name="mycontent", label="mycontent", enabled=1, arches=["i386", "s390"]) self.assertTrue(isinstance(c.arches, list)) self.assertTrue("i386" in c.arches) self.assertTrue("s390" in c.arches)
def test_compare(self): c = Content(content_type="yum", name="mycontent", label="mycontent", enabled=1, arches=['ALL']) d = c e = Content(content_type="yum", name="mycontent", label="mycontent", enabled=1, arches=['ALL']) f = Content(content_type="yum", name="othercontent", label="othercontent", enabled=1) self.assertEqual(c, c) self.assertNotEqual(c, None) self.assertNotEqual(c, "not a content") self.assertEqual(c, d) self.assertEqual(c, e) self.assertNotEqual(c, f)