1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2024-11-24 08:02:18 +02:00

partial fix to issue #50 and issue #37 to select token from database

This commit is contained in:
Brad Rydzewski 2014-02-11 16:05:53 -07:00
parent cc95546a5b
commit 088c45941c
2 changed files with 15 additions and 3 deletions

View File

@ -28,6 +28,10 @@ func TestGetUser(t *testing.T) {
t.Errorf("Exepected Password %s, got %s", "$2a$10$b8d63QsTL38vx7lj0HEHfOdbu1PCAg6Gfca74UavkXooIBx9YxopS", u.Password)
}
if u.Token != "123" {
t.Errorf("Exepected Token %s, got %s", "123", u.Token)
}
if u.Name != "Brad Rydzewski" {
t.Errorf("Exepected Name %s, got %s", "Brad Rydzewski", u.Name)
}
@ -60,6 +64,10 @@ func TestGetUserEmail(t *testing.T) {
t.Errorf("Exepected Password %s, got %s", "$2a$10$b8d63QsTL38vx7lj0HEHfOdbu1PCAg6Gfca74UavkXooIBx9YxopS", u.Password)
}
if u.Token != "123" {
t.Errorf("Exepected Token %s, got %s", "123", u.Token)
}
if u.Name != "Brad Rydzewski" {
t.Errorf("Exepected Name %s, got %s", "Brad Rydzewski", u.Name)
}
@ -155,6 +163,10 @@ func TestListUsers(t *testing.T) {
t.Errorf("Exepected Password %s, got %s", "$2a$10$b8d63QsTL38vx7lj0HEHfOdbu1PCAg6Gfca74UavkXooIBx9YxopS", u.Password)
}
if u.Token != "123" {
t.Errorf("Exepected Token %s, got %s", "123", u.Token)
}
if u.Name != "Brad Rydzewski" {
t.Errorf("Exepected Name %s, got %s", "Brad Rydzewski", u.Name)
}

View File

@ -12,21 +12,21 @@ const userTable = "users"
// SQL Queries to retrieve a user by their unique database key
const userFindIdStmt = `
SELECT id, email, password, name, gravatar, created, updated, admin,
SELECT id, email, password, token, name, gravatar, created, updated, admin,
github_login, github_token, bitbucket_login, bitbucket_token, bitbucket_secret
FROM users WHERE id = ?
`
// SQL Queries to retrieve a user by their email address
const userFindEmailStmt = `
SELECT id, email, password, name, gravatar, created, updated, admin,
SELECT id, email, password, token, name, gravatar, created, updated, admin,
github_login, github_token, bitbucket_login, bitbucket_token, bitbucket_secret
FROM users WHERE email = ?
`
// SQL Queries to retrieve a list of all users
const userStmt = `
SELECT id, email, password, name, gravatar, created, updated, admin,
SELECT id, email, password, token, name, gravatar, created, updated, admin,
github_login, github_token, bitbucket_login, bitbucket_token, bitbucket_secret
FROM users
ORDER BY name ASC