Add missing `defer rows.Close()` for potential early errors in models

- Minor method rename in integration tests.
parent 98aab9a3
......@@ -97,7 +97,7 @@ class TestCreateAndGetAllJobsJson < Minitest::Test
end
end
def test_job_created_and_deleted
def test_job_all_created
assert_equal 200, @allcode
assert @ids.include?(@post1body['id'])
assert @ids.include?(@post2body['id'])
......
......@@ -97,7 +97,7 @@ class TestCreateAndGetAllJobsXml < Minitest::Test
end
end
def test_job_created_and_deleted
def test_job_all_created
assert_equal 200, @allcode
assert @ids.include?(@post1body['job'][0]['id'][0])
assert @ids.include?(@post2body['job'][0]['id'][0])
......
......@@ -97,7 +97,7 @@ class TestCreateAndGetAllUsersJson < Minitest::Test
end
end
def test_user_created_and_deleted
def test_user_all_created
assert_equal 200, @allcode
assert @ids.include?(@post1body['id'])
assert @ids.include?(@post2body['id'])
......
......@@ -97,7 +97,7 @@ class TestCreateAndGetAllUsersXml < Minitest::Test
end
end
def test_user_created_and_deleted
def test_user_all_created
assert_equal 200, @allcode
assert @ids.include?(@post1body['user'][0]['id'][0])
assert @ids.include?(@post2body['user'][0]['id'][0])
......
......@@ -112,6 +112,7 @@ func GetJobs(clientu *User) ([]Job, error) {
return jobs, err
}
defer rows.Close()
for rows.Next() {
var j Job
if err = rows.Scan(&j.ID, &j.UserID, &j.Status, &j.StartedAt,
......
......@@ -181,6 +181,7 @@ func GetUsers(clientu *User) ([]User, error) {
return users, err
}
defer rows.Close()
for rows.Next() {
var u User
if err = rows.Scan(&u.ID, &u.UserType, &u.FirstName, &u.LastName, &u.Email,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment