This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ./ogs_btm_tester.py all | |
| This is a script to perform a simple verification of a wallet platform's integration with OGS BTM. | |
| Wallet URL: http://localhost:8080 | |
| Session ID: 3f1b039f-e53a-4c36-a289-0eca51640c6c | |
| Performing test: all | |
| ----------------------- | |
| 2019-10-28 14:37:41.862413 Testing Ping | |
| REQUEST: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Service holds data required for registration. | |
| type Service struct { | |
| Validater | |
| Repository | |
| } | |
| // Registrate holds registration domain logic. | |
| func (s *Service) Registrate(ctx context.Context, f *Form) (*User, error) { | |
| if err := s.Validater.Validate(ctx, f); err != nil { | |
| return nil, errors.Wrap(err, "validater validate") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Registrater abstraction for registration service. | |
| type Registrater interface { | |
| Registrate(*Form) (*User, error) | |
| } | |
| // RegistrationHandler for regisration requests. | |
| type RegistrationHandler struct { | |
| Registrater | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Repository is a data access layer. | |
| type Repository interface { | |
| Unique(email string) error | |
| Create(*Form) (*User, error) | |
| } | |
| // Validater validation abstraction. | |
| type Validater interface { | |
| Validate(*Form) error | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Repository is a data access layer. | |
| type Repository interface { | |
| Exists(email string) (bool, error) | |
| Create(*Form) (*User, error) | |
| } | |
| // RegistrationHandler for handling registration requests. | |
| type RegistrationHandler struct { | |
| Validator *validator.Validate | |
| Repository |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package execute | |
| import ( | |
| "bytes" | |
| "errors" | |
| "testing" | |
| "github.com/stretchr/testify/assert" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package execute | |
| import ( | |
| "errors" | |
| "fmt" | |
| "io" | |
| ) | |
| var ( | |
| // ErrExpectedError return when error is expected. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // A Handler responds to an HTTP request. | |
| type Handler interface { | |
| ServeHTTP(ResponseWriter, *Request) | |
| } | |
| // The HandlerFunc type is an adapter to allow the use of | |
| // ordinary functions as HTTP handlers. If f is a function | |
| // with the appropriate signature, HandlerFunc(f) is a | |
| // Handler that calls f. | |
| type HandlerFunc func(ResponseWriter, *Request) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "database/sql" | |
| "fmt" | |
| "os" | |
| "testing" | |
| "time" | |
| _ "github.com/go-sql-driver/mysql" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func prepareMySQL(t *testing.T) (db *sql.DB, cleanup func() error) { | |
| db, err := sql.Open("mysql", "test:test@tcp(localhost:3306)/test")) | |
| if err != nil { | |
| t.Fatalf("open mysql connection: %s", err) | |
| } | |
| return db, func() error { | |
| if _, err := db.Exec("TRUNCATE table_name;"); err != nil { | |
| return err |
NewerOlder