Changeset 15821 in project


Ignore:
Timestamp:
09/10/09 22:37:51 (10 years ago)
Author:
sjamaan
Message:

Fix calls to _set-user and add in some more tests

Location:
release/4/estraier-client
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/estraier-client/estraier-client.scm

    r15820 r15821  
    9494            (admins (read-block in))
    9595            (guests (read-block in)))
     96       ;; According to the docs, there's more info after GUESTS but I can't
     97       ;; seem to get this, so let's just read out just to be sure (for now)
     98       (discard-output in)
    9699       `((name . ,(first db-info))
    97100         (label . ,(second db-info))
     
    273276
    274277(define (delete-user node name)
    275   (_set-user name 0))
     278  (_set-user node name 0))
    276279
    277280(define (register-admin node name)
    278   (_set-user name 1))
     281  (_set-user node name 1))
    279282
    280283(define (register-guest node name)
    281   (_set-user name 2))
     284  (_set-user node name 2))
    282285
    283286;; TODO: _set_link
  • release/4/estraier-client/tests/run.scm

    r15820 r15821  
    6060  (test "Document list starts out empty"
    6161        '() (list-documents node-uri))
     62
     63  (test "After adding admins and a guests, they are listed in node info"
     64        '(("guest1" "guest2") ("admin1" "admin2"))
     65        (begin (register-guest node-uri "guest1")
     66               (register-guest node-uri "guest2")
     67               (register-admin node-uri "admin1")
     68               (register-admin node-uri "admin2")
     69               (let ((info (node-info node-uri)))
     70                 (list (alist-ref 'guests info) (alist-ref 'admins info)))))
     71 
    6272  (test-error "Putting document without URI is an error"
    6373              (put-document node-uri "This is just a test" '()))
    6474  (test-assert "Putting documents with URIs succeed"
    6575               (begin
    66                  (put-document node-uri "Just a test" '((@uri . "/test1")))
    67                  (put-document node-uri "Another test" '((@uri . "/test2")))
     76                 (put-document node-uri "Just a test for estraier"
     77                               '((@uri . "/test1")))
     78                 (put-document node-uri "Another test for estraier"
     79                               '((@uri . "/test2")))
    6880                 #t))
    69   (test "Nodes are listed"
     81  ;; If we don't sync, the newly added docs don't (always?) show up...
     82  (test-assert "Synchronize works" (begin (node-sync node-uri) #t))
     83  (let ((info (node-info node-uri)))
     84    (test "Node-info reports the new documents"
     85          2 (alist-ref 'document-count info))
     86    (test "Node-info reports the total number of words"
     87          6 (alist-ref 'word-count info))  ;; "test for estraier" is in both
     88    ;; Why does this still report zero?
     89    #;(test-assert "Size is nonzero" (> 0 (alist-ref 'size info))))
     90  (test "Documents are listed"
    7091        '("/test1" "/test2")
    7192        (map (lambda (l) (alist-ref '@uri l)) (list-documents node-uri)))
    72   (test "Skipping a node works"
     93  (test "Skipping list results works"
    7394        '("/test2")
    7495        (map (lambda (l) (alist-ref '@uri l))
     
    7899        (map (lambda (l) (alist-ref '@uri l))
    79100             (list-documents node-uri max: 1)))
     101
     102  (receive (results meta-data)
     103    (find-documents node-uri phrase: "test")
     104    (test "Find-documents finds both docs"
     105          '(((#f . "Just a ") ("test" . "test") (#f . " for estraier"))
     106            ((#f . "Another ") ("test" . "test") (#f . " for estraier")))
     107          (map car results))
     108    (test "URI matches put-document"
     109          "/test1"
     110          (alist-ref '@uri (cdr (car results))))
     111    (test "document-uri->id gives result that matches search result details"
     112          (string->number (alist-ref '@id (cdr (car results))))
     113          (document-uri->id node-uri "/test1")))
    80114
    81115  (test "Clearing node results in empty document list"
Note: See TracChangeset for help on using the changeset viewer.