def test_get_strict_no_profile_in_config(self): """ Test if SaltInvocationError exception will be raised if we don't have expected profile in the minion config """ msg = 'SDB profile "salt" wasnt found in the minion configuration' with self.assertRaisesRegex(SaltInvocationError, msg) as cm: sdb.get("sdb://salt/foo", strict=True)
def test_get_strict_no_profile(self): """ Test if SaltInvocationError exception will be raised if we don't have a valid profile in the uri """ msg = "SDB uri must have a profile name as a first part of the uri before the /" with self.assertRaisesRegex(SaltInvocationError, msg) as cm: sdb.get("sdb://salt", strict=True)
def test_get_strict_no_sdb_in_uri(self): """ Test if SaltInvocationError exception will be raised if we don't start uri with sdb:// """ msg = 'SDB uri must start with "sdb://"' with self.assertRaisesRegex(SaltInvocationError, msg) as cm: sdb.get("://salt/foo", strict=True)
def test_get_strict_no_sdb_in_uri(): """ Test if SaltInvocationError exception will be raised if we don't start uri with sdb:// """ msg = 'SDB uri must start with "sdb://"' with pytest.raises(SaltInvocationError, match=msg) as cm: sdb.get("://salt/foo", strict=True)
def test_get(self): ''' Test if it gets a value from a db, using a uri in the form of sdb://<profile>/<key> ''' self.assertEqual(sdb.get('sdb://salt/foo'), 'sdb://salt/foo')
def test_get(self): """ Test if it gets a value from a db, using a uri in the form of sdb://<profile>/<key> """ self.assertEqual(sdb.get("sdb://salt/foo"), "sdb://salt/foo")
def test_get(): """ Test if it gets a value from a db, using a uri in the form of sdb://<profile>/<key> """ assert sdb.get("sdb://salt/foo") == "sdb://salt/foo"