[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taldir] branch master updated: more tests
From: |
gnunet |
Subject: |
[taler-taldir] branch master updated: more tests |
Date: |
Thu, 07 Jul 2022 11:20:10 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository taldir.
The following commit(s) were added to refs/heads/master by this push:
new 7662410 more tests
7662410 is described below
commit 7662410ce9e08e7a214dd4d93aa8fe5df708b3b2
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Thu Jul 7 11:20:07 2022 +0200
more tests
---
cmd/taldir-server/main_test.go | 41 ++++++++++++++++++++++
cmd/taldir-server/testdata/taldir-test.conf | 16 +--------
.../taldir-server/testdata}/taldir-validate-test | 0
taldir.conf | 6 +---
4 files changed, 43 insertions(+), 20 deletions(-)
diff --git a/cmd/taldir-server/main_test.go b/cmd/taldir-server/main_test.go
index 90729c2..a4479f9 100644
--- a/cmd/taldir-server/main_test.go
+++ b/cmd/taldir-server/main_test.go
@@ -103,3 +103,44 @@ func TestRegisterRequest(s *testing.T) {
s.Errorf("Expected response code %d. Got %d\n", http.StatusNoContent,
response.Code)
}
}
+
+func TestRegisterRequestWrongPubkey(s *testing.T) {
+ t.ClearDatabase()
+
+ req, _ := http.NewRequest("POST", "/register/test",
bytes.NewBuffer(validRegisterRequest))
+ response := executeRequest(req)
+
+ if http.StatusAccepted != response.Code {
+ s.Errorf("Expected response code %d. Got %d\n", http.StatusAccepted,
response.Code)
+ }
+ file, err := os.Open("validation_code")
+ if err != nil {
+ s.Errorf("No validation code file found!\n")
+ }
+ code, err := ioutil.ReadAll(file)
+ if err != nil {
+ s.Errorf("Error reading validation code file contents!\n")
+ }
+ log.Printf("Got code: %s\n", code)
+ h_addr := getHAddress("abc@test")
+ trimCode := strings.Trim(string(code), " \r\n")
+ solution :=
util.GenerateSolution("000G006XE97PTWV3B7AJNCRQZA6BF26HPV3XZ07293FMY7KD4181946AA0",
trimCode)
+ solutionJSON := "{\"solution\": \"" + solution + "\"}"
+ req, _ = http.NewRequest("POST", "/" + h_addr,
bytes.NewBuffer([]byte(solutionJSON)))
+ response = executeRequest(req)
+ if http.StatusForbidden != response.Code {
+ s.Errorf("Expected response code %d. Got %d\n", http.StatusForbidden,
response.Code)
+ }
+}
+
+
+func TestUnsupportedMethod(s *testing.T) {
+ t.ClearDatabase()
+
+ req, _ := http.NewRequest("POST", "/register/email",
bytes.NewBuffer(validRegisterRequest))
+ response := executeRequest(req)
+
+ if http.StatusNotFound != response.Code {
+ s.Errorf("Expected response code %d. Got %d\n", http.StatusNotFound,
response.Code)
+ }
+}
diff --git a/cmd/taldir-server/testdata/taldir-test.conf
b/cmd/taldir-server/testdata/taldir-test.conf
index 536a741..1db6526 100644
--- a/cmd/taldir-server/testdata/taldir-test.conf
+++ b/cmd/taldir-server/testdata/taldir-test.conf
@@ -8,23 +8,9 @@ monthly_fee = KUDOS:1
request_frequency = 3
validation_landing = testdata/templates/validation_landing.html
-[taldir-email]
-sender = "taldir@taler.net"
-challenge_fee = KUDOS:0.5
-command = validate_email.sh
-
-[taldir-phone]
-challenge_fee = KUDOS:5
-requires_payment = true
-command = validate_phone.sh
-
[taldir-test]
challenge_fee = KUDOS:23
-command = taldir-validate-test
-
-[taldir-twitter]
-challenge_fee = KUDOS:2
-command = taldir-validate-twitter
+command = testdata/taldir-validate-test
[taldir-pq]
host = "localhost"
diff --git a/scripts/taldir-validate-test
b/cmd/taldir-server/testdata/taldir-validate-test
similarity index 100%
rename from scripts/taldir-validate-test
rename to cmd/taldir-server/testdata/taldir-validate-test
diff --git a/taldir.conf b/taldir.conf
index aac8fe1..a24771d 100644
--- a/taldir.conf
+++ b/taldir.conf
@@ -1,6 +1,6 @@
[taldir]
production = false
-validators = "twitter test"
+validators = "twitter"
host = "https://taldir.net"
bind_to = "localhost:11000"
salt = "ChangeMe"
@@ -17,10 +17,6 @@ challenge_fee = KUDOS:5
requires_payment = true
command = validate_phone.sh
-[taldir-test]
-challenge_fee = KUDOS:23
-command = taldir-validate-test
-
[taldir-twitter]
challenge_fee = KUDOS:2
command = taldir-validate-twitter
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.