aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmd/lulu/main.go11
-rw-r--r--cmd/lulu/testchecks/vc2
-rw-r--r--cmd/lulu/testchecks/vi_basic3
-rw-r--r--cmd/lulu/tests/vc1
-rw-r--r--cmd/lulu/tests/vi2
-rw-r--r--cmd/lulu/tests/vi_basic1
-rw-r--r--cover.go4
7 files changed, 19 insertions, 5 deletions
diff --git a/cmd/lulu/main.go b/cmd/lulu/main.go
index 8d3527b..3ab4b8a 100644
--- a/cmd/lulu/main.go
+++ b/cmd/lulu/main.go
@@ -157,7 +157,6 @@ func validateInterior(name string, clnt *lulu.Client, args []string) {
if len(val.ValidPkgIds) > 0 {
fmt.Printf("valid %ss: %v\n", typeName(val.ValidPkgIds[0]), val.ValidPkgIds)
}
-
for _, err := range val.Errors {
lg.Printf("lulu error: %s\n", err)
}
@@ -189,7 +188,15 @@ func validateCover(name string, clnt *lulu.Client, args []string) {
if err != nil {
lg.Fatal(err)
}
- fmt.Println(val) // TODO: output format?
+
+ fmt.Println("status:", val.Status)
+ fmt.Println("id:", val.Id)
+ for _, err := range val.Errors {
+ lg.Printf("lulu error: %s\n", err)
+ }
+ if len(val.Errors) > 0 || val.Status != lulu.CoverStatusNormalized {
+ os.Exit(1)
+ }
}
func coverDimensions(name string, clnt *lulu.Client, args []string) {
diff --git a/cmd/lulu/testchecks/vc b/cmd/lulu/testchecks/vc
new file mode 100644
index 0000000..c8404ed
--- /dev/null
+++ b/cmd/lulu/testchecks/vc
@@ -0,0 +1,2 @@
+grep '^status: NORMALIZED$' <$1
+grep '^id: [1-9][0-9]*$' <$1
diff --git a/cmd/lulu/testchecks/vi_basic b/cmd/lulu/testchecks/vi_basic
new file mode 100644
index 0000000..3293dbc
--- /dev/null
+++ b/cmd/lulu/testchecks/vi_basic
@@ -0,0 +1,3 @@
+grep '^status: VALIDATED$' <$1
+grep '^id: [1-9][0-9]*$' <$1
+grep '^valid PkgIds: \[[A-Z0-9. ]\+\]$' <$1
diff --git a/cmd/lulu/tests/vc b/cmd/lulu/tests/vc
new file mode 100644
index 0000000..f5859d3
--- /dev/null
+++ b/cmd/lulu/tests/vc
@@ -0,0 +1 @@
+lulu -s vc -mfg 0600X0900.BW.STD.PB.060UW444.MXX -url 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AADP367j0bTWlt8fCu-_tm2ia/161025/139056_cover.pdf?dl=1' -n 210
diff --git a/cmd/lulu/tests/vi b/cmd/lulu/tests/vi
index 8a074c3..5ca8cc9 100644
--- a/cmd/lulu/tests/vi
+++ b/cmd/lulu/tests/vi
@@ -1 +1 @@
-lulu -s vi -mfg 0600X0900.BW.PRE.PB.060UW444.MXX -url https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1 -t 30s
+lulu -s vi -mfg 0600X0900.BW.PRE.PB.060UW444.MXX -url 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1' -t 30s
diff --git a/cmd/lulu/tests/vi_basic b/cmd/lulu/tests/vi_basic
new file mode 100644
index 0000000..78cc8a8
--- /dev/null
+++ b/cmd/lulu/tests/vi_basic
@@ -0,0 +1 @@
+lulu -s vi -basic -url 'https://www.dropbox.com/sh/p3zh22vzsaegiri/AACOUn3LFKsITDzylh13bQpsa/161025/thesis2.pdf?dl=1'
diff --git a/cover.go b/cover.go
index e5ad857..8897a09 100644
--- a/cover.go
+++ b/cover.go
@@ -86,9 +86,9 @@ func (cd CoverDimensions) String() string {
// CoverValidation contains the validation status of a cover file.
type CoverValidation struct {
- Id uint
+ Id uint `json:"id"`
SrcUrl string `json:"source_url"`
NPages uint `json:"page_count"`
- Errors string
+ Errors []string `json:"errors"`
Status CoverValidationStatus
}