--[[----------------------------------------------------------------------------

WFCatFacesTest.lua

--------------------------------------------------------------------------------

ADOBE CONFIDENTIAL
------------------
Copyright 2017 Adobe Systems Incorporated
All Rights Reserved.

NOTICE: All information contained herein is, and remains the property of
Adobe Systems Incorporated and its suppliers, if any. The intellectual and
technical concepts contained herein are proprietary to Adobe Systems
Incorporated and its suppliers and are protected by all applicable
intellectual property laws, including trade secret and copyright laws.
Dissemination of this information or reproduction of this material is
strictly forbidden unless prior written permission is obtained from
Adobe Systems Incorporated.

----------------------------------------------------------------------------]]--

	-- WF.core.self_test
local WFRxTestCase = require 'WFRxTestCase'

	-- WF.core.utils
local KSTableUtils = require 'KSTableUtils'

	-- WF.oz_client.managed_catalog
local WFCatMockCatalog = require 'WFCatMockCatalog'
local WFCatFaces = require 'WFCatFaces'
local WFCatPerson = require 'WFCatPerson'
local WFOzTestUtils = require 'WFOzTestUtils'

--------------------------------------------------------------------------------

local createFakeWFCatalog = WFCatMockCatalog.createFakeWFCatalog
local derefOpt = KSTableUtils.derefOpt


--==============================================================================

local WFCatFacesTest = {}

--------------------------------------------------------------------------------

local function addDoc( docStore, docId )
	return docStore:setDocValue {
			_id = docId,
			type = 'asset',
			subtype = 'image',
			_localOnly = {
				files = {
					proxy = {
						pano = {
							relativePath = 'foo',
							volumeGuid = 'bar'
						}
					}
				}
			},
			importSource = {
				filePath = '/path/',
				originalHeight = 150,
				originalWidth = 100,
			}
		}
end

--------------------------------------------------------------------------------

function WFCatFacesTest.rxTestAddFace( rxTest )

	rxTest:setTimeLimit( 50 )

	local fakeWFCatalog = createFakeWFCatalog( rxTest )

	local docStore = fakeWFCatalog:docStore()
	
	
	-- Test making assets are copies ( none of them are previously copies )
	local docId = 'doc1'
	rxTest:expectSingleValue( addDoc( docStore, docId ), ':ignore:' )
	
	local assetDoc
	rxTest:expectSingleValue(
		docStore:docValue( docId )
		:map( function( docValue )
			assetDoc = docValue
			return docValue
		end ), 
		':ignore:' )
	
	local faceInfo = {
		name = "TestFace",
		desc = "Face created for testing",
		
	}
	local faceArea = {
		x = 0.12,
		y = 0.14,
		w = 150,
		h = 150,
	}
	
	local faceDetails = {
		faceInfo = faceInfo,
		faceArea = faceArea,
	}
	
	local appliedToDimensions = {
		w = 1240,
		h = 400
	}
	
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( fakeWFCatalog, docId, appliedToDimensions, { faceDetails } ), ':ignore:' )
	
	
	local updatedDoc
	rxTest:expectSingleValue(
		docStore:docValue( docId )
		:map( function( docValue )
			updatedDoc = docValue
			return docValue
		end ), 
		':ignore:' )

	local appliedDimensionXmp = derefOpt( updatedDoc, 'xmp', 'mwg-rs', 'Regions', 'AppliedToDimensions' )
	assert( appliedDimensionXmp and appliedDimensionXmp.w == appliedToDimensions.w, "AppliedToDimensions not added" )
	
	local regionList = derefOpt( updatedDoc, 'xmp', 'mwg-rs', 'Regions', 'RegionList' )
	
	local nRegions = 0
	for regionId, region in pairs( regionList ) do
		if type( regionId ) == 'string' and type( region ) == 'table' then
			nRegions = nRegions + 1
			assert( region.Type == "Face", "Incorrect Type data" )
		end
	end
	
	assert( regionList and nRegions == 1, "Regions not added" )
	
	rxTest:expectOnlyError( WFCatFaces.addFacesToAsset( fakeWFCatalog, docId, {}, {} ), "face_overlay_error"  )

	rxTest:expectOnlyError( WFCatFaces.addFacesToAsset( fakeWFCatalog, "xyz", {}, {} ), "face_overlay_error"  )
end

--------------------------------------------------------------------------------

function WFCatFacesTest.rxTestGetPhotoCountforPersonIds( rxTest )

	rxTest:setTimeLimit( 20 )

	local wfCatalog = createFakeWFCatalog( rxTest )
	
	local docStore = wfCatalog:docStore()
	local addAssetFn = WFOzTestUtils.v2.makeAdderOfAsset( rxTest, docStore,
		function( baseDocValue, uuid)
			baseDocValue._id = uuid
			return baseDocValue
		end )
	
	addAssetFn( 'image1' )
	addAssetFn( 'image2' )
	addAssetFn( 'image3' )
	addAssetFn( 'image4' )
	addAssetFn( 'image5' )
	addAssetFn( 'image6' )

	local personIds = { "person1", "person2", "person6", "person7", "person10" }
	local observable = rxTest:observe( WFCatFaces.getPhotoCountforPersonIds( wfCatalog, personIds ) )
	
	local personList = {
		{ 
			name = 'John',
			uuid = 'person1',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Ken',
			uuid = 'person2',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Matt',
			uuid = 'person3',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Craig',
			uuid = 'person4',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'kelly',
			uuid = 'person5',
			hidden = false,
			primary = 'person1',
			cover = "b"
		},
		{ 
			name = 'skdjs',
			uuid = 'person6',
			hidden = false,
			primary = 'not there',
			cover = "b"
		},
		{ 
			name = 'lksdjls',
			uuid = 'person7',
			hidden = false,
			cover = "b"
		},
	}
	rxTest:expectSingleValue( WFCatPerson.addPersons( wfCatalog, personList ), ':ignore:' )
	
	local appliedToDimensions = {
		w = 600,
		h = 400
	}
	
	local faceInfo = {
		uuid = "face1",
		name = "TestFace",
		desc = "Face created for testing",
	}
	
	local faceArea = {
		x = 0,
		y = 0,
		w = 150,
		h = 150,
	}
	
	local faceDetails = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person1" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image1", appliedToDimensions, faceDetails ), ':ignore:' )
	
	local faceDetails1 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image2", appliedToDimensions, faceDetails1 ), ':ignore:' )
	
	local faceDetails2 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image3", appliedToDimensions, faceDetails2 ), ':ignore:' )
	
	local faceDetails3 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image4", appliedToDimensions, faceDetails3 ), ':ignore:' )
	
	local faceDetails4 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image5", appliedToDimensions, faceDetails4 ), ':ignore:' )
	
	local faceDetails5 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person5" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person6" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image6", appliedToDimensions, faceDetails5 ), ':ignore:' )
	
	local expectedData = {
		["person1"] = 2,
		["person2"] = 2,
		["person6"] = 1,
	}
	
	observable:expectDataWithinTime( 10, expectedData )
	observable:dispose()
end

--------------------------------------------------------------------------------

function WFCatFacesTest.rxTestGetPeopleForImageIds( rxTest )

	rxTest:setTimeLimit( 20 )

	local wfCatalog = createFakeWFCatalog( rxTest )
	
	local docStore = wfCatalog:docStore()
	local addAssetFn = WFOzTestUtils.v2.makeAdderOfAsset( rxTest, docStore,
		function( baseDocValue, uuid)
			baseDocValue._id = uuid
			return baseDocValue
		end )
	
	addAssetFn( 'image1' )
	addAssetFn( 'image2' )
	addAssetFn( 'image3' )
	addAssetFn( 'image4' )
	addAssetFn( 'image5' )
	addAssetFn( 'image6' )

	local imageIds = { 1, 2 }
	local observable = rxTest:observe( WFCatFaces.getPeopleForImageIds( wfCatalog, imageIds ) )
	
	local personList = {
		{ 
			name = 'John',
			uuid = 'person1',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Ken',
			uuid = 'person2',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Matt',
			uuid = 'person3',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Craig',
			uuid = 'person4',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'kelly',
			uuid = 'person5',
			hidden = false,
			primary = 'person1',
			cover = "b"
		},
		{ 
			name = 'skdjs',
			uuid = 'person6',
			hidden = false,
			primary = 'not there',
			cover = "b"
		},
	}
	rxTest:expectSingleValue( WFCatPerson.addPersons( wfCatalog, personList ), ':ignore:' )
	
	local appliedToDimensions = {
		w = 600,
		h = 400
	}
	
	local faceInfo = {
		uuid = "face1",
		name = "TestFace",
		desc = "Face created for testing",
	}
	
	local faceArea = {
		x = 0,
		y = 0,
		w = 150,
		h = 150,
	}
	
	local faceDetails = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person1" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image1", appliedToDimensions, faceDetails ), ':ignore:' )
	
	local faceDetails1 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image2", appliedToDimensions, faceDetails1 ), ':ignore:' )
	
	local faceDetails2 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image3", appliedToDimensions, faceDetails2 ), ':ignore:' )
	
	local faceDetails3 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image4", appliedToDimensions, faceDetails3 ), ':ignore:' )
	
	local faceDetails4 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image5", appliedToDimensions, faceDetails4 ), ':ignore:' )
	
	local faceDetails5 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person5" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person6" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image6", appliedToDimensions, faceDetails5 ), ':ignore:' )
	
	
	local expectedData = {
		hiddenPeopleList = {
		},
		noPeopleList = {
		},
		peopleList = {
			{
				childId = "person1",
				faceId = "face1",
				height = 150,
				id = "person1",
				localAssetId = 1,
				name = "John",
				ozAssetId = "image1",
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			{
				childId = "person2",
				faceId = "face1",
				height = 150,
				id = "person2",
				localAssetId = 1,
				name = "Ken",
				ozAssetId = "image1",
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			{
				childId = "person3",
				faceId = "face1",
				height = 150,
				id = "person3",
				localAssetId = 2,
				name = "Matt",
				ozAssetId = "image2",
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			{
				childId = "person2",
				faceId = "face1",
				height = 150,
				id = "person2",
				localAssetId = 2,
				name = "Ken",
				ozAssetId = "image2",
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
		},
	}
	
	observable:expectDataWithinTime( 10, expectedData )
	observable:dispose()
	
	local observable2 = rxTest:observe( WFCatFaces.getPeopleForImageIds( wfCatalog, { 5 } ) )
	observable2:expectDataWithinTime( 10, {
		noPeopleList = {
			{
				faceId = "face1",
				height = 150,
				localAssetId = 5,
				ozAssetId = "image5",
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
		},
		peopleList = {
		},
		hiddenPeopleList = {
		},
		} )
	observable2:dispose()
	
	local observable3 = rxTest:observe( WFCatFaces.getPeopleForImageIds( wfCatalog, { 6 } ) )
	observable3:expectDataWithinTime( 10, {
		hiddenPeopleList = {
		},
		noPeopleList = {
		},
		peopleList = {
			{
				childId = "person6",
				faceId = "face1",
				height = 150,
				id = "person6",
				localAssetId = 6,
				name = "skdjs",
				ozAssetId = "image6",
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			{
				childId = "person5",
				faceId = "face1",
				height = 150,
				id = "person1",
				localAssetId = 6,
				name = "John",
				ozAssetId = "image6",
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			}})
	observable3:dispose()
	
	local observable4 = rxTest:observe( WFCatFaces.getPeopleForImageIds( wfCatalog, {} ) )
	observable4:expectDataWithinTime( 10, {
		noPeopleList = {
		},
		peopleList = {
		},
		hiddenPeopleList = {
		}})
	observable4:dispose()
	
	local observable5 = rxTest:observe( WFCatFaces.getPeopleForImageIds( wfCatalog, { 8, 9 } ) )
	observable5:expectDataWithinTime( 10, {
	noPeopleList = {
		},
		peopleList = {
		},
		hiddenPeopleList = {
		}})
	observable5:dispose()
end

--------------------------------------------------------------------------------

function WFCatFacesTest.rxTestGetDistinctPeopleForImageIds( rxTest )

	rxTest:setTimeLimit( 20 )

	local wfCatalog = createFakeWFCatalog( rxTest )
	
	local docStore = wfCatalog:docStore()
	local addAssetFn = WFOzTestUtils.v2.makeAdderOfAsset( rxTest, docStore,
		function( baseDocValue, uuid)
			baseDocValue._id = uuid
			return baseDocValue
		end )
	
	addAssetFn( 'image1' )
	addAssetFn( 'image2' )
	addAssetFn( 'image3' )
	addAssetFn( 'image4' )
	addAssetFn( 'image5' )
	addAssetFn( 'image6' )

	local imageIds = { 1, 2 }
	local observable = rxTest:observe( WFCatFaces.getDistinctPeopleForImageIds( wfCatalog, imageIds ) 
							:map( function(rows)
								local people = {}
								for i = 1, #rows do
									local id, name = unpack( rows[ i ], 1, 2 )
									people[ #people + 1 ] = {
										id = id,
										name = name,
									}
								end

								table.sort( people, function(a ,b)
									return a.id < b.id 
								end)
								return people
							end ))
	
	local observable2 = rxTest:observe( WFCatFaces.getDistinctPeopleForImageIds( wfCatalog, { 3, 5 } )
							:map( function(rows)
								local people = {}
								for i = 1, #rows do
									local id, name = unpack( rows[ i ], 1, 2 )
									people[ #people + 1 ] = {
										id = id,
										name = name,
									}
								end
								table.sort( people, function(a ,b)
									return a.id < b.id 
								end)
								return people
							end ))
	local observable3 = rxTest:observe( WFCatFaces.getDistinctPeopleForImageIds( wfCatalog, { 6 } ) 
							:map( function(rows)
								local people = {}
								for i = 1, #rows do
									local id, name = unpack( rows[ i ], 1, 2 )
									people[ #people + 1 ] = {
										id = id,
										name = name,
									}
								end
								table.sort( people, function(a ,b)
									return a.id < b.id 
								end)
								return people
							end ))
	local observable4 = rxTest:observe( WFCatFaces.getDistinctPeopleForImageIds( wfCatalog, { } ) 
							:map( function(rows)
								local people = {}
								for i = 1, #rows do
									local id, name = unpack( rows[ i ], 1, 2 )
									people[ #people + 1 ] = {
										id = id,
										name = name,
									}
								end
								table.sort( people, function(a ,b)
									return a.id < b.id 
								end)
								return people
							end ))
	local observable5 = rxTest:observe( WFCatFaces.getDistinctPeopleForImageIds( wfCatalog, { 10, 11} ) 
							:map( function(rows)
								local people = {}
								for i = 1, #rows do
									local id, name = unpack( rows[ i ], 1, 2 )
									people[ #people + 1 ] = {
										id = id,
										name = name,
									}
								end
								table.sort( people, function(a ,b)
									return a.id < b.id 
								end)
								return people
							end ))
	
	local personList = {
		{ 
			name = 'John',
			uuid = 'person1',
			hidden = false,
			cover = "b",
			primary = "person5"
		},
		{ 
			name = 'Ken',
			uuid = 'person2',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Matt',
			uuid = 'person3',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Craig',
			uuid = 'person4',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'kelly',
			uuid = 'person5',
			hidden = false,
			primary = 'person1',
			cover = "b"
		},
		{ 
			name = 'qwe',
			uuid = 'person6',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'dfss',
			uuid = 'person7',
			hidden = false,
			primary = 'person6',
			cover = "b"
		},
		{ 
			name = 'vdfd',
			uuid = 'person8',
			hidden = false,
			primary = 'person9',
			cover = "b"
		},
		{ 
			name = 'c1',
			uuid = 'person10',
			hidden = false,
			primary = 'person11',
			cover = "b"
		},
		{ 
			name = 'c2',
			uuid = 'person11',
			hidden = false,
			primary = 'person10',
			cover = "b"
		},
	}
	rxTest:expectSingleValue( WFCatPerson.addPersons( wfCatalog, personList ), ':ignore:' )
	
	local appliedToDimensions = {
		w = 600,
		h = 400
	}
	
	local faceInfo = {
		name = "TestFace",
		desc = "Face created for testing",
	}
	
	local faceArea = {
		x = 0,
		y = 0,
		w = 150,
		h = 150,
	}
	
	local faceDetails = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person1" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image1", appliedToDimensions, faceDetails ), ':ignore:' )
	
	local faceDetails1 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image2", appliedToDimensions, faceDetails1 ), ':ignore:' )
	
	local faceDetails2 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image3", appliedToDimensions, faceDetails2 ), ':ignore:' )
	
	local faceDetails3 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image4", appliedToDimensions, faceDetails3 ), ':ignore:' )
	
	local faceDetails4 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image5", appliedToDimensions, faceDetails4 ), ':ignore:' )
	
	local faceDetails5 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person7" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person8" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image6", appliedToDimensions, faceDetails5 ), ':ignore:' )
	
	local expectedData = { 
		{
			id = "person2",
			name = "Ken",
		},
		{
			id = "person3",
			name = "Matt",
		},
		{
			id = "person5",
			name = "kelly",
		},
	}
	
	observable:expectDataWithinTime( 10, expectedData )
	observable:dispose()
	
	local expectedData2 = { 
		{
			id = "person3",
			name = "Matt",
		},
		{
			id = "person4",
			name = "Craig",
		},
	}
	observable2:expectDataWithinTime( 10, expectedData2 )
	observable2:dispose()
	
	local expectedData3 = { 
		{
			id = "person6",
			name = "qwe",
		},
		{
			id = "person9",
			name = "vdfd",
		},
	}
	observable3:expectDataWithinTime( 10, expectedData3 )
	observable3:dispose()
	
	observable4:expectDataWithinTime( 10, {} )
	observable4:dispose()
	
	observable5:expectDataWithinTime( 10, {} )
	observable5:dispose()
end

--------------------------------------------------------------------------------

function WFCatFacesTest.rxTestGetDistinctPeopleForAllPhotos( rxTest )

	rxTest:setTimeLimit( 20 )

	local wfCatalog = createFakeWFCatalog( rxTest )
	
	local docStore = wfCatalog:docStore()
	local addAssetFn = WFOzTestUtils.v2.makeAdderOfAsset( rxTest, docStore,
		function( baseDocValue, uuid)
			baseDocValue._id = uuid
			return baseDocValue
		end )
	
	addAssetFn( 'image1' )
	addAssetFn( 'image2' )
	addAssetFn( 'image3' )
	addAssetFn( 'image4' )
	addAssetFn( 'image5' )
	addAssetFn( 'image6' )

	local observable = rxTest:observe( WFCatFaces.getDistinctPeopleForAllPhotos( wfCatalog ) 
							:map( function(rows)
								local people = {}
								for i = 1, #rows do
									local id, name = unpack( rows[ i ], 1, 2 )
									people[ #people + 1 ] = {
										id = id,
										name = name,
									}
								end
								table.sort( people, function(a ,b)
									return a.id < b.id 
								end)
								return people
							end ))
	
	local personList = {
		{ 
			name = 'John',
			uuid = 'person1',
			hidden = false,
			cover = "b",
			primary = "person5"
		},
		{ 
			name = 'Ken',
			uuid = 'person2',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Matt',
			uuid = 'person3',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Craig',
			uuid = 'person4',
			hidden = true,
			cover = "b"
		},
		{ 
			name = 'kelly',
			uuid = 'person5',
			hidden = false,
			primary = 'person1',
			cover = "b"
		},
		{ 
			name = 'qwe',
			uuid = 'person6',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'dfss',
			uuid = 'person7',
			hidden = false,
			primary = 'person6',
			cover = "b"
		},
		{ 
			name = 'vdfd',
			uuid = 'person8',
			hidden = false,
			primary = 'person9',
			cover = "b"
		},
		{ 
			name = 'c1',
			uuid = 'person10',
			hidden = false,
			primary = 'person11',
			cover = "b"
		},
		{ 
			name = 'c2',
			uuid = 'person11',
			hidden = false,
			primary = 'person10',
			cover = "b"
		},
	}
	rxTest:expectSingleValue( WFCatPerson.addPersons( wfCatalog, personList ), ':ignore:' )
	
	local appliedToDimensions = {
		w = 600,
		h = 400
	}
	
	local faceInfo = {
		name = "TestFace",
		desc = "Face created for testing",
	}
	
	local faceArea = {
		x = 0,
		y = 0,
		w = 150,
		h = 150,
	}
	
	local faceDetails = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person1" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image1", appliedToDimensions, faceDetails ), ':ignore:' )
	
	local faceDetails1 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image2", appliedToDimensions, faceDetails1 ), ':ignore:' )
	
	local faceDetails2 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image3", appliedToDimensions, faceDetails2 ), ':ignore:' )
	
	local faceDetails3 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image4", appliedToDimensions, faceDetails3 ), ':ignore:' )
	
	local faceDetails4 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person9" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image5", appliedToDimensions, faceDetails4 ), ':ignore:' )
	
	local faceDetails5 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person7" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person8" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image6", appliedToDimensions, faceDetails5 ), ':ignore:' )
	
	local expectedData = { 
		{
			id = "person2",
			name = "Ken",
		},
		{
			id = "person3",
			name = "Matt",
		},
		{
			id = "person5",
			name = "kelly",
		},
		{
			id = "person6",
			name = "qwe",
		},
		{
			id = "person9",
			name = "vdfd",
		},
	}
	
	observable:expectDataWithinTime( 10, expectedData )
	observable:dispose()
end

--------------------------------------------------------------------------------

function WFCatFacesTest.rxTestGetPeopleInfoForAllAssets( rxTest )

	rxTest:setTimeLimit( 10 )

	local wfCatalog = createFakeWFCatalog( rxTest )
	
	local docStore = wfCatalog:docStore()
	local addAssetFn = WFOzTestUtils.v2.makeAdderOfAsset( rxTest, docStore,
		function( baseDocValue, uuid)
			baseDocValue._id = uuid
			return baseDocValue
		end )
	
	addAssetFn( 'image1' )
	addAssetFn( 'image2' )
	addAssetFn( 'image3' )
	addAssetFn( 'image4' )
	addAssetFn( 'image5' )

	local observable = rxTest:observe( WFCatFaces.getPeopleInfoForAllAssets( wfCatalog, 1 ) )
	
	local personList = {
		{ 
			name = 'John',
			uuid = 'person1',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Ken',
			uuid = 'person2',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Matt',
			uuid = 'person3',
			hidden = true,
			cover = "b"
		},
		{ 
			name = 'Craig',
			uuid = 'person4',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'kelly',
			uuid = 'person5',
			hidden = false,
			primary = 'person1',
			cover = "b"
		},
		{ 
			name = 'ben',
			uuid = 'person6',
			hidden = false,
			primary = 'personNoThere',
			cover = "b"
		},
		{ 
			name = 'ben',
			uuid = 'person7',
			hidden = false,
			primary = 'person3',
			cover = "b"
		},
		{ 
			name = 'grey',
			uuid = 'person8',
			hidden = true,
			primary = 'person3',
			cover = "b"
		},
		{ 
			name = 'c1',
			uuid = 'person9',
			hidden = false,
			primary = 'person10',
			cover = "b"
		},
		{ 
			name = 'c2',
			uuid = 'person10',
			hidden = false,
			primary = 'person9',
			cover = "b"
		},
	}
	rxTest:expectSingleValue( WFCatPerson.addPersons( wfCatalog, personList ), ':ignore:' )
	rxTest:expectSingleValue( WFCatPerson.addPersons( wfCatalog, {} ), ':ignore:' )
	
	local appliedToDimensions = {
		w = 600,
		h = 400
	}
	
	local faceInfo = {
		name = "TestFace",
		desc = "Face created for testing",
	}
	
	local faceArea = {
		x = 0,
		y = 0,
		w = 150,
		h = 150,
	}
	
	local faceDetails = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person1" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image1", appliedToDimensions, faceDetails ), ':ignore:' )
	
	local faceDetails1 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image2", appliedToDimensions, faceDetails1 ), ':ignore:' )
	
	local faceDetails2 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image3", appliedToDimensions, faceDetails2 ), ':ignore:' )
	
	local faceDetails3 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image4", appliedToDimensions, faceDetails3 ), ':ignore:' )
	
	local faceDetails4 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person6" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person9" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image5", appliedToDimensions, faceDetails4 ), ':ignore:' )
	
	local faceDetails5 = {
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person7" } }
		},
		{
			faceInfo = faceInfo,
			faceArea = faceArea,
			people = { { id = "person10" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image5", appliedToDimensions, faceDetails5 ), ':ignore:' )
	
	local expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person10 = {
			count = 1,
			cover = 5,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person10",
			mergedIdsSet = {
			},
			name = "c2",
		},
		person2 = {
			count = 2,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person2",
			mergedIdsSet = {
			},
			name = "Ken",
		},
		person3 = {
			count = 3,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
				person7 = "Matt",
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},
		person6 = {
			count = 1,
			cover = 5,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person6",
			mergedIdsSet = {
			},
			name = "ben",
		},
		person9 = {
			count = 1,
			cover = 5,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person9",
			mergedIdsSet = {
			},
			name = "c1",
		},
	}
	
	observable:expectDataWithinTime( 5, expectedData )

	observable:dispose()
end

--------------------------------------------------------------------------------

function WFCatFacesTest.rxTestRemovePersonFromAssets( rxTest )

	rxTest:setTimeLimit( 40 )

	local wfCatalog = createFakeWFCatalog( rxTest )
	
	local docStore = wfCatalog:docStore()
	local addAssetFn = WFOzTestUtils.v2.makeAdderOfAsset( rxTest, docStore,
		function( baseDocValue, uuid)
			baseDocValue._id = uuid
			return baseDocValue
		end )
	
	addAssetFn( 'image1' )
	addAssetFn( 'image2' )
	addAssetFn( 'image3' )
	addAssetFn( 'image4' )
	addAssetFn( 'image5' )

	local observable = rxTest:observe( WFCatFaces.getPeopleInfoForAllAssets( wfCatalog, 1 ) )
	
	local personList = {
		{ 
			name = 'John',
			uuid = 'person1',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Ken',
			uuid = 'person2',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Matt',
			uuid = 'person3',
			hidden = true,
			cover = "b"
		},
		{ 
			name = 'Craig',
			uuid = 'person4',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'kelly',
			uuid = 'person5',
			hidden = false,
			primary = 'person1',
			cover = "b"
		},
		{ 
			name = 'ben',
			uuid = 'person6',
			hidden = false,
			primary = 'personNoThere',
			cover = "b"
		},
		{ 
			name = 'ben',
			uuid = 'person7',
			hidden = false,
			primary = 'person3',
			cover = "b"
		},
		{ 
			name = 'grey',
			uuid = 'person8',
			hidden = true,
			primary = 'person3',
			cover = "b"
		},
	}
	rxTest:expectSingleValue( WFCatPerson.addPersons( wfCatalog, personList ), ':ignore:' )
	
	local appliedToDimensions = {
		w = 600,
		h = 400
	}
	
	local faceArea = {
		x = 0,
		y = 0,
		w = 150,
		h = 150,
	}
	
	local faceDetails = {
		{
			faceInfo = { uuid = "face1" },
			faceArea = faceArea,
			people = { { id = "person1" } }
		},
		{
			faceInfo = { uuid = "face2" },
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image1", appliedToDimensions, faceDetails ), ':ignore:' )
	
	local faceDetails1 = {
		{
			faceInfo = { uuid = "face3" },
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = { uuid = "face4" },
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image2", appliedToDimensions, faceDetails1 ), ':ignore:' )
	
	local faceDetails2 = {
		{
			faceInfo = { uuid = "face5" },
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = { uuid = "face6" },
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image3", appliedToDimensions, faceDetails2 ), ':ignore:' )
	
	local faceDetails3 = {
		{
			faceInfo = { uuid = "face7" },
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image4", appliedToDimensions, faceDetails3 ), ':ignore:' )
	
	local faceDetails4 = {
		{
			faceInfo = { uuid = "face8" },
			faceArea = faceArea,
		},
		{
			faceInfo = { uuid = "face9" },
			faceArea = faceArea,
			people = { { id = "person8" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image5", appliedToDimensions, faceDetails4 ), ':ignore:' )
	
	local expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person2 = {
			count = 2,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person2",
			mergedIdsSet = {
			},
			name = "Ken",
		},
		person3 = {
			count = 3,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
				person8 = "Matt",
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},

	}
	
	observable:expectDataWithinTime( 10, expectedData )
	
	--Test 1
	rxTest:expectSingleValue( WFCatFaces.removePeopleFromAssets( wfCatalog, {"person4"}, {1,2} ), ':ignore:' )
	expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person2 = {
			count = 2,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person2",
			mergedIdsSet = {
			},
			name = "Ken",
		},
		person3 = {
			count = 3,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
				person8 = "Matt",
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	--Test 2
	rxTest:expectSingleValue( WFCatFaces.removePeopleFromAssets( wfCatalog, {"person2"}, {1,2} ), ':ignore:' )
	expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person3 = {
			count = 3,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
				person8 = "Matt",
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	--Test 3
	rxTest:expectSingleValue( WFCatFaces.removePeopleFromAssets( wfCatalog, { "person3", "person7", "person8" }, {5} ), ':ignore:' )
	expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person3 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	--Test 4 invalid personid
	rxTest:expectSingleValue( WFCatFaces.removePeopleFromAssets( wfCatalog, {}, {5} ), ':ignore:' )
	expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person3 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	--Test 5 - invalid personid and imageid
	rxTest:expectSingleValue( WFCatFaces.removePeopleFromAssets( wfCatalog, { "person77" }, { 88 } ), ':ignore:' )
	expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person3 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	observable:dispose()
end

--------------------------------------------------------------------------------

function WFCatFacesTest.rxTestRemovePersonFromTagsPanel( rxTest )

	rxTest:setTimeLimit( 40 )

	local wfCatalog = createFakeWFCatalog( rxTest )
	
	local docStore = wfCatalog:docStore()
	local addAssetFn = WFOzTestUtils.v2.makeAdderOfAsset( rxTest, docStore,
		function( baseDocValue, uuid)
			baseDocValue._id = uuid
			return baseDocValue
		end )
	
	addAssetFn( 'image1' )
	addAssetFn( 'image2' )
	addAssetFn( 'image3' )
	addAssetFn( 'image4' )
	addAssetFn( 'image5' )

	local observable = rxTest:observe( WFCatFaces.getPeopleInfoForAllAssets( wfCatalog, 1 ) )
	
	local personList = {
		{ 
			name = 'John',
			uuid = 'person1',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Ken',
			uuid = 'person2',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Matt',
			uuid = 'person3',
			hidden = true,
			cover = "b"
		},
		{ 
			name = 'Craig',
			uuid = 'person4',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'kelly',
			uuid = 'person5',
			hidden = false,
			primary = 'person1',
			cover = "b"
		},
		{ 
			name = 'ben',
			uuid = 'person6',
			hidden = false,
			primary = 'personNoThere',
			cover = "b"
		},
		{ 
			name = 'ben',
			uuid = 'person7',
			hidden = false,
			primary = 'person3',
			cover = "b"
		},
		{ 
			name = 'grey',
			uuid = 'person8',
			hidden = true,
			primary = 'person3',
			cover = "b"
		},
	}
	rxTest:expectSingleValue( WFCatPerson.addPersons( wfCatalog, personList ), ':ignore:' )
	
	local appliedToDimensions = {
		w = 600,
		h = 400
	}
	
	local faceArea = {
		x = 0,
		y = 0,
		w = 150,
		h = 150,
	}
	
	local faceDetails = {
		{
			faceInfo = { uuid = "face1" },
			faceArea = faceArea,
			people = { { id = "person1" } }
		},
		{
			faceInfo = { uuid = "face2" },
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image1", appliedToDimensions, faceDetails ), ':ignore:' )
	
	local faceDetails1 = {
		{
			faceInfo = { uuid = "face3" },
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = { uuid = "face4" },
			faceArea = faceArea,
			people = { { id = "person2" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image2", appliedToDimensions, faceDetails1 ), ':ignore:' )
	
	local faceDetails2 = {
		{
			faceInfo = { uuid = "face5" },
			faceArea = faceArea,
			people = { { id = "person3" } }
		},
		{
			faceInfo = { uuid = "face6" },
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image3", appliedToDimensions, faceDetails2 ), ':ignore:' )
	
	local faceDetails3 = {
		{
			faceInfo = { uuid = "face7" },
			faceArea = faceArea,
			people = { { id = "person4" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image4", appliedToDimensions, faceDetails3 ), ':ignore:' )
	
	local faceDetails4 = {
		{
			faceInfo = { uuid = "face8" },
			faceArea = faceArea,
		},
		{
			faceInfo = { uuid = "face9" },
			faceArea = faceArea,
			people = { { id = "person8" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image5", appliedToDimensions, faceDetails4 ), ':ignore:' )
	
	local expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person2 = {
			count = 2,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person2",
			mergedIdsSet = {
			},
			name = "Ken",
		},
		person3 = {
			count = 3,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
				person8 = "Matt",
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},

	}
	
	observable:expectDataWithinTime( 10, expectedData )
	
	--------------------------------------------------------------------------------
	local input = {
		{
			personId = "person4",
			faceId = "face1",
			assetId = 1,
		}
	}

	rxTest:expectSingleValue( WFCatFaces.removePersonFromTagsPanel( wfCatalog, input ), ':ignore:' )
	expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person2 = {
			count = 2,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person2",
			mergedIdsSet = {
			},
			name = "Ken",
		},
		person3 = {
			count = 3,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
				person8 = "Matt",
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	--------------------------------------------------------------------------------
	input = {
		{
			personId = "person2",
			faceId = "face2",
			assetId = 1,
		},
		{
			personId = "person2",
			faceId = "face4",
			assetId = 2,
		}
	}
	
	rxTest:expectSingleValue( WFCatFaces.removePersonFromTagsPanel( wfCatalog, input ), ':ignore:' )
	expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person3 = {
			count = 3,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
				person8 = "Matt",
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	--------------------------------------------------------------------------------
	input = {
		{
			personId = "person3",
			faceId = "face2",
			assetId = 5,
		},
		{
			personId = "person7",
			faceId = "face4",
			assetId = 5,
		},
		{
			personId = "person8",
			faceId = "face9",
			assetId = 5,
		}
	}
	
	rxTest:expectSingleValue( WFCatFaces.removePersonFromTagsPanel( wfCatalog, input ), ':ignore:' )
	expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person3 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	--------------------------------------------------------------------------------
	input = {
		{
			faceId = "face2",
			assetId = 5,
		},
	}
	
	rxTest:expectSingleValue( WFCatFaces.removePersonFromTagsPanel( wfCatalog, input ), ':ignore:' )
	expectedData = { 
		person1 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person1",
			mergedIdsSet = {
			},
			name = "John",
		},
		person3 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "person3",
			mergedIdsSet = {
			},
			name = "Matt",
		},
		person4 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "person4",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	observable:dispose()
end

--------------------------------------------------------------------------------

function WFCatFacesTest.rxTestMoveAssetsToAnotherPerson( rxTest )

	rxTest:setTimeLimit( 20 )

	local wfCatalog = createFakeWFCatalog( rxTest )
	
	local docStore = wfCatalog:docStore()
	local addAssetFn = WFOzTestUtils.v2.makeAdderOfAsset( rxTest, docStore,
		function( baseDocValue, uuid)
			baseDocValue._id = uuid
			return baseDocValue
		end )
	
	addAssetFn( 'image1' )
	addAssetFn( 'image2' )
	addAssetFn( 'image3' )
	addAssetFn( 'image4' )
	addAssetFn( 'image5' )

	local observable = rxTest:observe( WFCatFaces.getPeopleInfoForAllAssets( wfCatalog, 1 ) )
	
	local personList = {
		{ 
			name = 'John',
			uuid = 'ca09100b9fe0ba5c14e784e886642606',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Ken',
			uuid = 'ca09100b9fe0ba5c14e784e886642607',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'Matt',
			uuid = 'ca09100b9fe0ba5c14e784e886642608',
			hidden = true,
			cover = "image5"
		},
		{ 
			name = 'Craig',
			uuid = 'ca09100b9fe0ba5c14e784e886642609',
			hidden = false,
			cover = "b"
		},
		{ 
			name = 'kelly',
			uuid = 'ca09100b9fe0ba5c14e784e886642610',
			hidden = false,
			primary = 'ca09100b9fe0ba5c14e784e886642606',
			cover = "b"
		},
		{ 
			name = 'ben',
			uuid = 'ca09100b9fe0ba5c14e784e886642611',
			hidden = false,
			primary = 'ca09100b9fe0ba5c14e784e886642888',
			cover = "b"
		},
		{ 
			name = 'ben',
			uuid = 'ca09100b9fe0ba5c14e784e886642612',
			hidden = false,
			primary = 'ca09100b9fe0ba5c14e784e886642608',
			cover = "b"
		},
		{ 
			name = 'grey',
			uuid = 'ca09100b9fe0ba5c14e784e886642613',
			hidden = true,
			primary = 'ca09100b9fe0ba5c14e784e886642608',
			cover = "b"
		},
	}
	rxTest:expectSingleValue( WFCatPerson.addPersons( wfCatalog, personList ), ':ignore:' )
	
	local appliedToDimensions = {
		w = 600,
		h = 400
	}
	
	local faceArea = {
		x = 0,
		y = 0,
		w = 150,
		h = 150,
	}
	
	local faceDetails = {
		{
			faceInfo = { uuid = "face1" },
			faceArea = faceArea,
			people = { { id = "ca09100b9fe0ba5c14e784e886642606" } }
		},
		{
			faceInfo = { uuid = "face2" },
			faceArea = faceArea,
			people = { { id = "ca09100b9fe0ba5c14e784e886642607" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image1", appliedToDimensions, faceDetails ), ':ignore:' )
	
	local faceDetails1 = {
		{
			faceInfo = { uuid = "face3" },
			faceArea = faceArea,
			people = { { id = "ca09100b9fe0ba5c14e784e886642608" } }
		},
		{
			faceInfo = { uuid = "face4" },
			faceArea = faceArea,
			people = { { id = "ca09100b9fe0ba5c14e784e886642607" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image2", appliedToDimensions, faceDetails1 ), ':ignore:' )
	
	local faceDetails2 = {
		{
			faceInfo = { uuid = "face5" },
			faceArea = faceArea,
			people = { { id = "ca09100b9fe0ba5c14e784e886642608" } }
		},
		{
			faceInfo = { uuid = "face6" },
			faceArea = faceArea,
			people = { { id = "ca09100b9fe0ba5c14e784e886642609" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image3", appliedToDimensions, faceDetails2 ), ':ignore:' )
	
	local faceDetails3 = {
		{
			faceInfo = { uuid = "face7" },
			faceArea = faceArea,
			people = { { id = "ca09100b9fe0ba5c14e784e886642609" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image4", appliedToDimensions, faceDetails3 ), ':ignore:' )
	
	local faceDetails4 = {
		{
			faceInfo = { uuid = "face8" },
			faceArea = faceArea,
		},
		{
			faceInfo = { uuid = "face9" },
			faceArea = faceArea,
			people = { { id = "ca09100b9fe0ba5c14e784e886642613" } }
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, "image5", appliedToDimensions, faceDetails4 ), ':ignore:' )
	
	local expectedData = { 
		ca09100b9fe0ba5c14e784e886642606 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642606",
			mergedIdsSet = {
			},
			name = "John",
		},
		ca09100b9fe0ba5c14e784e886642607 = {
			count = 2,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642607",
			mergedIdsSet = {
			},
			name = "Ken",
		},
		ca09100b9fe0ba5c14e784e886642608 = {
			count = 3,
			cover = 5,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "ca09100b9fe0ba5c14e784e886642608",
			mergedIdsSet = {
				ca09100b9fe0ba5c14e784e886642613 = "Matt",
			},
			name = "Matt",
		},
		ca09100b9fe0ba5c14e784e886642609 = {
			count = 2,
			cover = 3,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642609",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	
	observable:expectDataWithinTime( 10, expectedData )
	
	--Test 1
	rxTest:expectSingleValue( WFCatFaces.moveAssetsToAnotherPerson( wfCatalog, "ca09100b9fe0ba5c14e784e886642609", {"ca09100b9fe0ba5c14e784e886642607"}, {1,2} ), ':ignore:' )
	expectedData = { 
		ca09100b9fe0ba5c14e784e886642606 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642606",
			mergedIdsSet = {
			},
			name = "John",
		},
		ca09100b9fe0ba5c14e784e886642608 = {
			count = 3,
			cover = 5,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "ca09100b9fe0ba5c14e784e886642608",
			mergedIdsSet = {
				ca09100b9fe0ba5c14e784e886642613 = "Matt",
			},
			name = "Matt",
		},
		ca09100b9fe0ba5c14e784e886642609 = {
			count = 4,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642609",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	--Test 2
	rxTest:expectSingleValue( WFCatFaces.moveAssetsToAnotherPerson( wfCatalog, "ca09100b9fe0ba5c14e784e886642609", {"ca09100b9fe0ba5c14e784e886642607"}, {1,2} ), ':ignore:' )
	expectedData = { 
		ca09100b9fe0ba5c14e784e886642606 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642606",
			mergedIdsSet = {
			},
			name = "John",
		},
		ca09100b9fe0ba5c14e784e886642608 = {
			count = 3,
			cover = 5,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "ca09100b9fe0ba5c14e784e886642608",
			mergedIdsSet = {
				ca09100b9fe0ba5c14e784e886642613 = "Matt",
			},
			name = "Matt",
		},
		ca09100b9fe0ba5c14e784e886642609 = {
			count = 4,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642609",
			mergedIdsSet = {
			},
			name = "Craig",
		},

	}
	observable:expectDataWithinTime( 10, expectedData )
	
	--Test 3
	rxTest:expectSingleValue( WFCatFaces.moveAssetsToAnotherPerson( wfCatalog, "ca09100b9fe0ba5c14e784e886642677", {"ca09100b9fe0ba5c14e784e886642607"}, {1,2} ), ':ignore:' )
	expectedData = { 
		ca09100b9fe0ba5c14e784e886642606 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642606",
			mergedIdsSet = {
			},
			name = "John",
		},
		ca09100b9fe0ba5c14e784e886642608 = {
			count = 3,
			cover = 5,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "ca09100b9fe0ba5c14e784e886642608",
			mergedIdsSet = {
				ca09100b9fe0ba5c14e784e886642613 = "Matt",
			},
			name = "Matt",
		},
		ca09100b9fe0ba5c14e784e886642609 = {
			count = 4,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642609",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	--Test 4
	rxTest:expectSingleValue( WFCatFaces.moveAssetsToAnotherPerson( wfCatalog, "ca09100b9fe0ba5c14e784e886642609", { "ca09100b9fe0ba5c14e784e886642677", "ca09100b9fe0ba5c14e784e886642620" }, { 1, 2 } ), ':ignore:' )
	expectedData = { 
		ca09100b9fe0ba5c14e784e886642606 = {
			count = 1,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642606",
			mergedIdsSet = {
			},
			name = "John",
		},
		ca09100b9fe0ba5c14e784e886642608 = {
			count = 3,
			cover = 5,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = true,
			id = "ca09100b9fe0ba5c14e784e886642608",
			mergedIdsSet = {
				ca09100b9fe0ba5c14e784e886642613 = "Matt",
			},
			name = "Matt",
		},
		ca09100b9fe0ba5c14e784e886642609 = {
			count = 4,
			cover = 1,
			coverFaceInfo = {
				height = 150,
				width = 150,
				x_axis = 0,
				y_axis = 0,
			},
			hidden = false,
			id = "ca09100b9fe0ba5c14e784e886642609",
			mergedIdsSet = {
			},
			name = "Craig",
		},
	}
	observable:expectDataWithinTime( 10, expectedData )
	
	observable:dispose()
end


--------------------------------------------------------------------------------

function WFCatFacesTest.rxTestUpdateFaceRegion( rxTest )

	rxTest:setTimeLimit( 5 )

	local wfCatalog = createFakeWFCatalog( rxTest )
	
	local docStore = wfCatalog:docStore()
	local addAssetFn = WFOzTestUtils.v2.makeAdderOfAsset( rxTest, docStore,
		function( baseDocValue, uuid)
			baseDocValue._id = uuid
			return baseDocValue
		end )
	
	addAssetFn( 'image1' )
	
	local appliedToDimensions = {
		w = 600,
		h = 400
	}
	
	local faceArea = {
		x = 0,
		y = 0,
		w = 0.5,
		h = 0.5,
	}
	
	local faceDetails = {
		{
			faceInfo = { uuid = "ba09100b9fe0ba5c14e784e886642606" },
			faceArea = faceArea,
			people = { { id = "ca09100b9fe0ba5c14e784e886642606" } }
		},
		{
			faceInfo = { uuid = "da09100b9fe0ba5c14e784e886642606" },
			faceArea = faceArea,
		},
	}
	rxTest:expectSingleValue( WFCatFaces.addFacesToAsset( wfCatalog, 1, appliedToDimensions, faceDetails ), ':ignore:' )
	
	local expectedData = {
		hiddenPeopleList = {
		},
		noPeopleList = {
			{
				faceId = "ba09100b9fe0ba5c14e784e886642606",
				height = 0.5,
				localAssetId = 1,
				ozAssetId = "image1",
				width = 0.5,
				x_axis = 0,
				y_axis = 0,
			},
			{
				faceId = "da09100b9fe0ba5c14e784e886642606",
				height = 0.5,
				localAssetId = 1,
				ozAssetId = "image1",
				width = 0.5,
				x_axis = 0,
				y_axis = 0,
			},
		},
		peopleList = {
		},
	}
	
	local imageIds = { 1 }
	local observable = rxTest:observe( WFCatFaces.getPeopleForImageIds( wfCatalog, imageIds ) )
	observable:expectDataWithinTime( 2, expectedData )
	observable:dispose()
	
	local newFaceArea = {
		x = 0.1,
		y = 0.2,
		w = 0.4,
		h = 0.4,
	}
	
	rxTest:expectSingleValue( WFCatFaces.updateFaceRegion( wfCatalog, 1, "da09100b9fe0ba5c14e784e886642606", newFaceArea ), ':ignore:' )
	
	expectedData = {
		hiddenPeopleList = {
		},
		noPeopleList = {
			{
				faceId = "da09100b9fe0ba5c14e784e886642606",
				height = 0.4,
				localAssetId = 1,
				ozAssetId = "image1",
				width = 0.4,
				x_axis = 0.1,
				y_axis = 0.2,
			},
			{
				faceId = "ba09100b9fe0ba5c14e784e886642606",
				height = 0.5,
				localAssetId = 1,
				ozAssetId = "image1",
				width = 0.5,
				x_axis = 0,
				y_axis = 0,
			},
		},
		peopleList = {
		},
	}
	
	observable = rxTest:observe( WFCatFaces.getPeopleForImageIds( wfCatalog, imageIds ) )
	observable:expectDataWithinTime( 2, expectedData )
	observable:dispose()
end

--------------------------------------------------------------------------------

return WFRxTestCase.wrapSuite( WFCatFacesTest )
