var _                 = require("lodash")
  , expect            = require("chai").expect
  , ubivar            = require("../../ubivar")
  , methods           = ["create","retrieve","del","list"]

describe("FlowBackup", function(){
  describe("Properties", function(){
    it("Should have a name and path attribute", function() {
      expect(ubivar["FlowBackup"]["path"]).to.exist
    })

    it("Should link to parent (ubivar)", function() {
      expect(ubivar["FlowBackup"]["ubivar"]).to.exist
    })

    _.each(methods, function(method){
      var METHOD      = method.toUpperCase()
      it("Should have "+METHOD+" methods", function(done) {
        if(!_.isFunction(ubivar["FlowBackup"][method])){
          return done(new Error("Should have "+METHOD+" methods"))
        }
        done()
      })
    })
  })


  describe("Methods", function(){

    it.skip("Should create a flow backup", function(todo){ todo() })

    it.skip("Should retrieve (restore) a flow backup", function(todo){ todo() })

    it.skip("Should delete a flow backup", function(todo){ todo() })

    it("Should list", function(done){
      ubivar["FlowBackup"].list(function(err, res){
        if(err) {
          console.log(err, res)
          done(err) 
        } else {
          done()
        }
      })
    })
  })
})

var _                 = require("lodash")
  , expect            = require("chai").expect
  , ubivar            = require("../../ubivar")
  , methods           = ["create","retrieve","del","list"]

describe("FlowBackup", function(){
  describe("Properties", function(){
    it("Should have a name and path attribute", function() {
      expect(ubivar["FlowBackup"]["path"]).to.exist
    })

    it("Should link to parent (ubivar)", function() {
      expect(ubivar["FlowBackup"]["ubivar"]).to.exist
    })

    _.each(methods, function(method){
      var METHOD      = method.toUpperCase()
      it("Should have "+METHOD+" methods", function(done) {
        if(!_.isFunction(ubivar["FlowBackup"][method])){
          return done(new Error("Should have "+METHOD+" methods"))
        }
        done()
      })
    })
  })


  describe("Methods", function(){

    it("Should create a flow backup", function(done){ 
      ubivar["FlowBackup"].create(function(err, res){
        if(err){ done(new Error("Did not create")) }

        var flows     = res.data
        console.log(flows)
        done()
      })
    })

    it.skip("Should retrieve (restore) a flow backup", function(todo){ todo() })

    it.skip("Should delete a flow backup", function(todo){ todo() })

    it("Should list", function(done){
      ubivar["FlowBackup"].list(function(err, res){
        if(err) {
          console.log(err, res)
          done(err) 
        } else {
          done()
        }
      })
    })
  })
})

add flows