def test_equality_not_equals(): """Check two pnfs are not equals if name is not the same.""" pnf_1 = Pnf(name="equal") pnf_1.identifier = "1234" pnf_2 = Pnf(name="not_equal") pnf_2.identifier = "1234" assert pnf_1 != pnf_2
def test_equality_really_equals(): """Check two pnfs are equals if name is the same.""" pnf_1 = Pnf(name="equal") pnf_1.identifier = "1234" pnf_2 = Pnf(name="equal") pnf_2.identifier = "1235" assert pnf_1 == pnf_2
def test_version_no_load_created(mock_load): """Test versions when created.""" pnf = Pnf() pnf.identifier = "1234" pnf._version = "64" assert pnf.version == "64" mock_load.assert_not_called()
def test_exists_not_exists(mock_get_all): """Return False if pnf doesn't exist in SDC.""" pnf_1 = Pnf(name="one") pnf_1.identifier = "1234" mock_get_all.return_value = [pnf_1] pnf = Pnf(name="two") assert not pnf.exists()
def test_equality_not_equals_not_same_object(): """Check a pnf and something different are not equals.""" pnf_1 = Pnf(name="equal") pnf_1.identifier = "1234" pnf_2 = SdcResource() pnf_2.name = "equal" assert pnf_1 != pnf_2
def test_exists(mock_get_all): """Return True if pnf exists in SDC.""" pnf_1 = Pnf(name="one") pnf_1.identifier = "1234" pnf_1.unique_uuid = "5689" pnf_1.unique_identifier = "71011" pnf_1.status = const.DRAFT pnf_1.version = "1.1" mock_get_all.return_value = [pnf_1] pnf = Pnf(name="one") assert pnf.exists() assert pnf.identifier == "1234" assert pnf.unique_uuid == "5689" assert pnf.unique_identifier == "71011" assert pnf.status == const.DRAFT assert pnf.version == "1.1"
def test_version_with_load(mock_load): """Test versions when not created but with identifier.""" pnf = Pnf() pnf.identifier = "1234" assert pnf.version is None mock_load.assert_called_once()