@@ -185,7 +185,7 @@ describe('integration-all-services', function() {
185185
186186 // this endpoint is flaky.
187187 // reported the issue to the team, but disabling the test for now.
188- describe . skip ( 'recognizeText()' , function ( ) {
188+ describe ( 'recognizeText()' , function ( ) {
189189 it ( 'read text in an uploaded image' , function ( done ) {
190190
191191 var params = {
@@ -229,45 +229,65 @@ describe('integration-all-services', function() {
229229 } ) ;
230230 } ) ;
231231
232- // there are currently too many classifiers on the account
233- // disabling this test until we can get separate credentials for the SDK
234- describe . skip ( 'listClassifiers()' , function ( ) {
235- it ( 'should return the list of classifiers' , function ( done ) {
232+
233+ // todo: add more tests, consider splitting things between a permanent and a temporary classifier
234+ describe ( "custom classifiers" , function ( ) {
235+ var classifier_id ;
236+ this . retries ( 0 ) ;
237+
238+ it ( 'createClassifier()' , function ( done ) {
239+ visual_recognition . createClassifier ( {
240+ name : 'light_dark_test_temporary' ,
241+ light_positive_examples : fs . createReadStream ( path . join ( __dirname , 'resources/light.zip' ) ) ,
242+ dark_positive_examples : fs . createReadStream ( path . join ( __dirname , 'resources/dark.zip' ) )
243+ } , function ( err , response ) {
244+ if ( err ) {
245+ return done ( err )
246+ }
247+ assert ( response ) ;
248+ assert ( response . classifier_id ) ;
249+ classifier_id = response . classifier_id ;
250+ done ( ) ;
251+ } ) ;
252+ } ) ;
253+
254+ it ( 'listClassifiers()' , function ( done ) {
236255 visual_recognition . listClassifiers ( { } , function ( err , result ) {
237256 if ( err ) {
238257 return done ( err ) ;
239258 }
240259 assert ( result . classifiers ) ;
241260 assert ( result . classifiers . length ) ;
242- assert ( result . classifiers [ 0 ] . classifier_id ) ;
243- assert ( result . classifiers [ 0 ] . name ) ;
244- assert ( result . classifiers [ 0 ] . status ) ;
261+ // hack until we're allowed multiple classifiers
262+ if ( ! classifier_id ) {
263+ classifier_id = result . classifiers [ 0 ] . classifier_id ;
264+ }
265+ // var permament_classifiers = result.classifiers.filter(function(c) {
266+ // return c.classifier_id === classifier_id;
267+ // });
268+ // assert(permament_classifiers.length);
245269 done ( ) ;
246270 } ) ;
247271 } ) ;
248- } ) ;
249272
250- describe ( 'getClassifier()' , function ( ) {
251- // todo: we need a separate key for the SDK tests.
252- // Right now it's shared with the demo and those classifiers sometimes get deleted :/
253- // disabling this test in the meanwhile
254- it . skip ( 'should retrieve the classifier' , function ( done ) {
255- var expected = {
256- "classifier_id" : "MoleskineTypes_1855242529" ,
257- "name" : "Moleskine Types" ,
258- "owner" : "a3a48ea7-492b-448b-87d7-9dade8bde5a9" ,
259- "status" : "ready" ,
260- "created" : "2016-06-21T02:38:57.661Z" ,
261- "classes" : [ { "class" : "portrait" } ] } ;
262- visual_recognition . getClassifier ( { classifier_id : 'MoleskineTypes_1855242529' } , function ( err , classifier ) {
273+ it ( 'getClassifier()' , function ( done ) {
274+ visual_recognition . getClassifier ( { classifier_id : classifier_id } , function ( err , classifier ) {
263275 if ( err ) {
264276 return done ( err ) ;
265277 }
266- assert . deepEqual ( classifier , expected ) ;
278+ assert . equal ( classifier . classifier_id , classifier_id ) ;
279+ assert . equal ( classifier . name , 'light_dark_test_temporary' ) ;
280+ assert . deepEqual ( classifier . classes , [ { "class" :"light" } , { "class" :"dark" } ] ) ;
267281 done ( ) ;
268282 } ) ;
269283 } ) ;
270- } ) ;
284+
285+ it ( 'deleteClassifier()' , function ( done ) {
286+ visual_recognition . deleteClassifier ( { classifier_id : classifier_id } , done ) ;
287+ } )
288+
289+ } ) ; // custom classifiers
290+
271291
272292 describe ( "collections" , function ( ) {
273293 this . retries ( 0 ) ;
0 commit comments