Improved Author unit tests

This commit is contained in:
konrad 2018-01-16 12:27:14 +01:00 committed by kolaente
parent adf7700a8a
commit 14651d198c
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 5 additions and 3 deletions

View File

@ -15,12 +15,14 @@ func TestAddOrUpdateAuthor(t *testing.T) {
// Create a new author
author1, err := AddOrUpdateAuthor(testauthor)
assert.NoError(t, err)
assert.Equal(t, testauthor.Forename, author1.Forename)
// And anotherone
_, err = AddOrUpdateAuthor(testauthor)
author2, err := AddOrUpdateAuthor(testauthor)
assert.NoError(t, err)
assert.Equal(t, testauthor.Forename, author2.Forename)
// As of now, we should have 2 author in total. Get the list and check.
// As of now, we should have 2 authors in total. Get the list and check.
allauthors, err := ListAuthors("")
assert.NoError(t, err)
@ -30,7 +32,7 @@ func TestAddOrUpdateAuthor(t *testing.T) {
}
// Get the new author
gotauthor, exists, err := GetAuthorByID(author1.ID)
gotauthor, exists, err := GetAuthorByID(1)
assert.NoError(t, err)
assert.True(t, exists)
assert.Equal(t, gotauthor.Forename, testauthor.Forename)