Improved Author unit tests
This commit is contained in:
parent
adf7700a8a
commit
14651d198c
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue