       ).then('list', -> @ 'monkeys', {}, noErr (monkeys) ->
         monkeys.length.should.eql 1
       ).then(done)
+
+
+
+    it "should provide some typical http-operations", (done) ->
+      api = manikin.create()
+
+      model =
+        accounts:
+          owners: {}
+          fields:
+            name: { type: 'string', default: '' }
+
+        companies:
+          owners:
+            account: 'accounts'
+          fields:
+            name: { type: 'string', default: '' }
+            orgnr: { type: 'string', default: '' }
+
+        employees:
+          owners:
+            company: 'companies'
+          fields:
+            name: { type: 'string', default: '' }
+
+        customers:
+          fields:
+            name: { type: 'string' }
+            at: { type: 'hasMany', model: 'companies' }
+
+      saved = {}
+
+      promise(api).connect(connectionData, model, noErr())
+      .post('accounts', { name: 'n1' }, noErr (a1) ->
+        a1.should.have.keys ['name', 'id']
+        saved.a1 = a1
+      ).then('post', -> @ 'accounts', { name: 'n2' }, noErr (a2) ->
+        a2.should.have.keys ['name', 'id']
+        saved.a2 = a2
+      ).list('accounts', {}, noErr (accs) ->
+        accs.should.eql [saved.a1, saved.a2]
+      ).then('getOne', -> @ 'accounts', { filter: { id: saved.a1.id } }, noErr (acc) ->
+        acc.should.eql saved.a1
+      ).then('getOne', -> @ 'accounts', { filter: { name: 'n2' } }, noErr (acc) ->
+        acc.should.eql saved.a2
+      ).then('getOne', -> @ 'accounts', { filter: { name: 'does-not-exist' } }, (err, acc) ->
+        err.toString().should.eql 'Error: No match'
+        should.not.exist acc
+
+      ).then('post', -> @ 'companies', { account: saved.a1.id, name: 'J Dev AB', orgnr: '556767-2208' }, noErr (company) ->
+        company.should.have.keys ['name', 'orgnr', 'account', 'id', 'at']
+        saved.c1 = company
+      ).then('post', -> @ 'companies', { account: saved.a1.id, name: 'Lean Machine AB', orgnr: '123456-1234' }, noErr (company) ->
+        company.should.have.keys ['name', 'orgnr', 'account', 'id', 'at']
+        saved.c2 = company
+      ).then('post', -> @ 'employees', { company: saved.c1.id, name: 'Jakob' }, noErr (company) ->
+        company.should.have.keys ['name', 'company', 'account', 'id']
+
+      # testing to get an account without nesting
+      ).then('getOne', -> @ 'accounts', { filter: { id: saved.a1.id } }, noErr (acc) ->
+        _(acc).omit('id').should.eql { name: 'n1' }
+
+      # testing to get an account with nesting
+      ).then('getOne', -> @ 'accounts', { nesting: 1, filter: { id: saved.a1.id } }, noErr (acc) ->
+        _(acc).omit('id').should.eql { name: 'n1' }
+
+
+      ).then ->
+        api.close(done)

      .list('companies2', {}, noErr ((res) -> res.length.should.eql 2))
      .list('accounts', {}, noErr ((res) -> res.length.should.eql 1))

      .then('delOne', -> @ 'companies2', { id: saved.company.id }, noErr())

      .list('pets', {}, noErr ((res) -> res.length.should.eql 1))
      .list('contacts', {}, noErr ((res) -> res.length.should.eql 1))
      .list('companies2', {}, noErr ((res) -> res.length.should.eql 1))
      .list('accounts', {}, noErr ((res) -> res.length.should.eql 1))

      .then -> api.close(done)


    it "should provide has-one-relations", (done) ->

        x[1].name.should.eql 'julia'
        x[1].age.should.eql 27
        x[1].city.should.eql 'sthlm'
      ).then ->
        api.close(done)



    it "can delete an object", (done) ->
      api = manikin.create()

      model =
        stuffz:
          fields:
            name: 'string'
            age: 'number'
            city: 'string'

      saved = {}

      promise(api).connect(connectionData, model, noErr())
      .post('stuffz', { name: 'jakob', age: 28, city: 'gbg' }, noErr())
      .post('stuffz', { name: 'julia', age: 27, city: 'gbg' }, noErr())
      .delOne('stuffz', { name: 'julia' }, noErr())
      .list('stuffz', { }, noErr (x) ->
        x.should.have.length 1
        x[0].name.should.eql 'jakob'
        x[0].age.should.eql 28
        x[0].city.should.eql 'gbg'
      ).then ->
        api.close(done)

