openbadgefactory / salava

Open Badge Passport community edition
Apache License 2.0
19 stars 8 forks source link

Tests in error #28

Closed cdisabatino closed 5 years ago

cdisabatino commented 5 years ago

Hello. When I run the tests with the command "lein repl (run-tests)", I have the errors below. What are they and how can I fix them ?

Thank you

2019/11/05 08:37:13.864 - compojure.api.exception : Table 'salava_test.user_badge_metabadge' doesn't exist java.sql.SQLSyntaxErrorException: Table 'salava_test.user_badge_metabadge' doesn't exist

ERROR in (main-test) (SQLError.java:120) Uncaught exception, not in assertion. expected: nil actual: java.sql.SQLSyntaxErrorException: Table 'salava_test.user_badge_endorsement_request' doesn't exist

2019/11/05 08:37:09.669 - salava.badge.main : send-badge-info-to-obf: #error { :cause GET request to https://openbadgefactory.com/c/badge/passport_update failed :via [{:type java.lang.Exception :message GET request to https://openbadgefactory.com/c/badge/passport_update failed :at [salava.core.http$curl invokeStatic http.clj 36]}]

FAIL in (main-test) (db_test.clj:13) Get Badge events expected: (= 1 (count connects)) actual: (not (= 1 0))

FAIL in (routes-test) (routes_test.clj:29) GET /badge user has two badges expected: (= 200 status) actual: (not (= 200 500))

FAIL in (routes-test) (routes_test.clj:34) GET /badge user has no badges expected: (= 200 status) actual: (not (= 200 500))

FAIL in (routes-test) (routes_test.clj:35) GET /badge user has no badges expected: (= 0 (count body)) actual: (not (= 0 2))

FAIL in (main-test) (main_test.clj:8) with correct values expected: (= "http://localhost:5000/badge/info/1" (b/badge-url ctx 1)) actual: (not (= "http://localhost:5000/badge/info/1" "http://___MYDOMAIN___/badge/info/1"))

FAIL in (main-test) (db_test.clj:26) register user register user with correct data expected: (= "success" (:status connect)) actual: (not (= "success" "error"))

FAIL in (main-test) (db_test.clj:27) register user register user with correct data expected: (= "" (:message connect)) actual: (not (= "" "user/Enteredaddressisalready"))

FAIL in (main-test) (db_test.clj:94) register user and accept terms accept terms expected: (= "accepted" (:input connect)) actual: (not (= "accepted" "disabled"))

FAIL in (main-test) (db_test.clj:100) register user and accept terms check if accepted terms expected: (= "accepted" connect) actual: (not (= "accepted" false))

Ran 10 tests containing 83 assertions. 9 failures, 1 errors. {:failures 10}

Isaakay111 commented 5 years ago

Hi, Fixes have been applied to the database migrations. Tests should now run smoothly.

cdisabatino commented 5 years ago

Hello, Thanks for the update.

I deleted the two databases and created them again before the test.

Result :

java.sql.SQLSyntaxErrorException: Table 'salava_test.user_badge_metabadge' doesn't exist

Ran 10 tests containing 83 assertions. 8 failures, 0 errors. {: failures 8}

Thank you

Isaakay111 commented 5 years ago

Hi, You have to enable the metabadge plugin. Add :metabadge to the enabled plugins in config/core.edn and test_config/core.edn

cdisabatino commented 5 years ago

Hello, I confirm, adding the plugin "metabadge", the associated errors is no longer present.

All that remains is the errors and warnings present in the attached file : error.txt

Thanks

Isaakay111 commented 5 years ago

Hi,

cdisabatino commented 5 years ago

It's much better. All that remains is the traces below (ignoring "send-badge-info-to-obf").

Should not add the plugin ": metabadge" in the GIT "config/core.edn.base" ?

Thanks

E 2019/11/08 14:38:27.423 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed E 2019/11/08 14:38:28.080 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed E 2019/11/08 14:38:28.724 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed E 2019/11/08 14:38:30.141 - salava.badge.parse : file->assertion: unsupported file type: text/plain E 2019/11/08 14:38:30.142 - salava.badge.parse : file->assertion: unsupported file type: image/bmp WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by clojure.lang.InjectedInvoker/0x00000008401e8440 (file:/root/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar) to method com.sun.org. apache.xerces.internal.jaxp.SAXParserImpl.parse(org.xml.sax.InputSource,org.xml.sax.HandlerBase) WARNING: Please consider reporting this to the maintainers of clojure.lang.InjectedInvoker/0x00000008401e8440 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release E 2019/11/08 14:38:36.295 - salava.badge.endorsement : {:status error, :message User cannot endorse himself} E 2019/11/08 14:38:37.017 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed E 2019/11/08 14:38:37.633 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed E 2019/11/08 14:38:38.281 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed I 2019/11/08 14:38:45.450 - salava.mail.mail : sending to test.registration@example.com I 2019/11/08 14:38:45.663 - salava.mail.mail : {:code 0, :error :SUCCESS, :message message sent}

FAIL in (main-test) (db_test.clj:26) register user register user with correct data expected: (= "success" (:status connect)) actual: (not (= "success" "error"))

FAIL in (main-test) (db_test.clj:27) register user register user with correct data expected: (= "" (:message connect)) actual: (not (= "" "user/Enteredaddressisalready"))

Ran 10 tests containing 83 assertions. 2 failures, 0 errors. {:failures 2}

Isaakay111 commented 5 years ago

Hi, Drop and recreate your salava_test db. Also, make sure you are in test mode before running tests.

cdisabatino commented 5 years ago

Hi, I resumed the procedure in its entirety. "git pull", drop and create database. I am in the test mode "IN TEST MODE: true". The result is identical to the previous message. Thank you

Isaakay111 commented 5 years ago

Hi, Still failures? Please, paste results here.

cdisabatino commented 5 years ago

It's the same as before (ignoring "send-badge-info-to-obf"). In the traces, there are WARNINGs but in the end report, there are two FAILs.

E 2019/11/12 12:45:08.352 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed E 2019/11/12 12:45:08.980 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed E 2019/11/12 12:45:09.606 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed E 2019/11/12 12:45:11.029 - salava.badge.parse : file->assertion: unsupported file type: text/plain E 2019/11/12 12:45:11.030 - salava.badge.parse : file->assertion: unsupported file type: image/bmp WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by clojure.lang.InjectedInvoker/0x00000008401e8440 (file:/root/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar) to method com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(org.xml.sax.InputSource,org.xml.sax.HandlerBase) WARNING: Please consider reporting this to the maintainers of clojure.lang.InjectedInvoker/0x00000008401e8440 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release E 2019/11/12 12:45:17.071 - salava.badge.endorsement : {:status error, :message User cannot endorse himself} E 2019/11/12 12:45:17.762 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed E 2019/11/12 12:45:18.367 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed E 2019/11/12 12:45:19.017 - salava.badge.main : send-badge-info-to-obf: GET request to https://openbadgefactory.com/c/badge/passport_update failed I 2019/11/12 12:45:26.325 - salava.mail.mail : sending to test.registration@example.com I 2019/11/12 12:45:26.415 - salava.mail.mail : {:code 0, :error :SUCCESS, :message message sent} Midje summary: No facts were checked. Is that what you wanted?

Output from clojure.test tests:

FAIL in (main-test) (db_test.clj:26) register user register user with correct data expected: (= "success" (:status connect)) actual: (not (= "success" "error"))

FAIL in (main-test) (db_test.clj:27) register user register user with correct data expected: (= "" (:message connect)) actual: (not (= "" "user/Enteredaddressisalready"))

Ran 10 tests containing 83 assertions. 2 failures, 0 errors. {:failures 2}

Isaakay111 commented 5 years ago

Hi, Tests should now run properly.

cdisabatino commented 5 years ago

Hello. Great job, there are no more mistakes. Only the warnings. I closed the issue.

Thank you very much, Have a good day.

Ran 9 tests containing 70 assertions. 0 failures, 0 errors. {:failures 0}

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by clojure.lang.InjectedInvoker/0x00000008401e8440 (file:/root/.m2/repository/org/clojure/clojure/1.10.0/clojure-1.10.0.jar) to method com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(org.xml.sax.InputSource,org.xml.sax.HandlerBase) WARNING: Please consider reporting this to the maintainers of clojure.lang.InjectedInvoker/0x00000008401e8440 WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release