[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

test[photos8] 00 Authorization




"Ensure the Photos.framework is bound to the system"
[ PHPhotoLibrary authorizationStatus ] on: Error do: [:error|
	self print: 'Photos.framework must be bound to application to run tests'.
	self abort
].


"Query authorization to use the Photos.framework"
self print: '// Authorization state is ' ,PHPhotoLibrary authorization.
self print: '//	' ,PHPhotoLibrary statusDescription.


"requestAuthorization if not defined"
PHPhotoLibrary authorization = #notDetermined ifTrue: [
	PHPhotoLibrary requestAuthorization
].


"Ensure the user grant access to Photos to continue tests"
PHPhotoLibrary authorization = #authorized ifFalse: [
    self print: 'Require user granted access to Photos.'.
    self abort
].