def test_get_all_no_vf(mock_send): """Returns empty array if no vfs.""" mock_send.return_value = {} assert Vf.get_all() == [] mock_send.assert_called_once_with( "GET", 'get Vfs', 'https://sdc.api.be.simpledemo.onap.org:30204/sdc/v1/catalog/resources?resourceType=VF' )
def test_get_all_some_vfs(mock_send): """Returns a list of vf.""" mock_send.return_value = [{ 'resourceType': 'VF', 'name': 'one', 'uuid': '1234', 'invariantUUID': '5678', 'version': '1.0', 'lifecycleState': 'CERTIFIED' }, { 'resourceType': 'VF', 'name': 'two', 'uuid': '1235', 'invariantUUID': '5679', 'version': '1.0', 'lifecycleState': 'NOT_CERTIFIED_CHECKOUT' }] all_vfs = Vf.get_all() assert len(all_vfs) == 2 vf_1 = all_vfs[0] assert vf_1.name == "one" assert vf_1.identifier == "1234" assert vf_1.unique_uuid == "5678" assert vf_1.version == "1.0" assert vf_1.status == const.CERTIFIED assert vf_1.created() vf_2 = all_vfs[1] assert vf_2.name == "two" assert vf_2.identifier == "1235" assert vf_2.unique_uuid == "5679" assert vf_2.status == const.DRAFT assert vf_2.version == "1.0" assert vf_2.created() mock_send.assert_called_once_with( "GET", 'get Vfs', 'https://sdc.api.be.simpledemo.onap.org:30204/sdc/v1/catalog/resources?resourceType=VF' )