diff --git a/arn/AnimeSort_test.go b/arn/AnimeSort_test.go index bb24e1e6..878329bb 100644 --- a/arn/AnimeSort_test.go +++ b/arn/AnimeSort_test.go @@ -3,8 +3,8 @@ package arn_test import ( "testing" + "github.com/akyoto/assert" "github.com/animenotifier/notify.moe/arn" - "github.com/stretchr/testify/assert" ) func TestAnimeSort(t *testing.T) { diff --git a/arn/Anime_test.go b/arn/Anime_test.go index dc3f7d15..94332c8d 100644 --- a/arn/Anime_test.go +++ b/arn/Anime_test.go @@ -3,28 +3,28 @@ package arn_test import ( "testing" + "github.com/akyoto/assert" "github.com/animenotifier/notify.moe/arn" - "github.com/stretchr/testify/assert" ) func TestNewAnime(t *testing.T) { anime := arn.NewAnime() assert.NotNil(t, anime) - assert.NotEmpty(t, anime.ID) - assert.NotEmpty(t, anime.Created) + assert.NotEqual(t, anime.ID, "") + assert.NotEqual(t, anime.Created, "") } func TestGetAnime(t *testing.T) { // Existing anime anime, err := arn.GetAnime("74y2cFiiR") - assert.NoError(t, err) + assert.Nil(t, err) assert.NotNil(t, anime) - assert.NotEmpty(t, anime.ID) - assert.NotEmpty(t, anime.Title.Canonical) + assert.NotEqual(t, anime.ID, "") + assert.NotEqual(t, anime.Title.Canonical, "") // Not existing anime anime, err = arn.GetAnime("does not exist") - assert.Error(t, err) + assert.NotNil(t, err) assert.Nil(t, anime) } @@ -49,14 +49,14 @@ func TestAllAnime(t *testing.T) { for _, anime := range allAnime { - assert.NotEmpty(t, anime.ID) - assert.Contains(t, validAnimeStatus, anime.Status, "[%s] %s", anime.ID, anime.String()) - assert.Contains(t, validAnimeType, anime.Type, "[%s] %s", anime.ID, anime.String()) - assert.Contains(t, validAnimeStatus, anime.CalculatedStatus(), "[%s] %s", anime.ID, anime.String()) - assert.NotEmpty(t, anime.StatusHumanReadable(), "[%s] %s", anime.ID, anime.String()) - assert.NotEmpty(t, anime.TypeHumanReadable(), "[%s] %s", anime.ID, anime.String()) - assert.NotEmpty(t, anime.Link(), "[%s] %s", anime.ID, anime.String()) - assert.NotEmpty(t, anime.EpisodeCountString(), "[%s] %s", anime.ID, anime.String()) + assert.NotEqual(t, anime.ID, "") + assert.Contains(t, validAnimeStatus, anime.Status) + assert.Contains(t, validAnimeType, anime.Type) + assert.Contains(t, validAnimeStatus, anime.CalculatedStatus()) + assert.NotEqual(t, anime.StatusHumanReadable(), "") + assert.NotEqual(t, anime.TypeHumanReadable(), "") + assert.NotEqual(t, anime.Link(), "") + assert.NotEqual(t, anime.EpisodeCountString(), "") anime.Episodes() anime.Characters() diff --git a/arn/Database_test.go b/arn/Database_test.go index a01d95ac..6827b922 100644 --- a/arn/Database_test.go +++ b/arn/Database_test.go @@ -3,10 +3,10 @@ package arn_test import ( "testing" + "github.com/akyoto/assert" "github.com/animenotifier/notify.moe/arn" - "github.com/stretchr/testify/assert" ) func TestConnect(t *testing.T) { - assert.NotEmpty(t, arn.DB.Node().Address().String()) + assert.NotEqual(t, arn.DB.Node().Address().String(), "") } diff --git a/arn/Inventory_test.go b/arn/Inventory_test.go index d95f88f5..46909e7e 100644 --- a/arn/Inventory_test.go +++ b/arn/Inventory_test.go @@ -3,18 +3,17 @@ package arn_test import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/akyoto/assert" "github.com/animenotifier/notify.moe/arn" ) func TestInventory(t *testing.T) { inventory := arn.NewInventory("4J6qpK1ve") - - assert.Len(t, inventory.Slots, arn.DefaultInventorySlotCount) + assert.Equal(t, len(inventory.Slots), arn.DefaultInventorySlotCount) assert.False(t, inventory.ContainsItem("pro-account-3")) err := inventory.AddItem("pro-account-3", 1) - assert.NoError(t, err) + assert.Nil(t, err) assert.True(t, inventory.ContainsItem("pro-account-3")) } diff --git a/arn/User_test.go b/arn/User_test.go index ac926a5b..45959627 100644 --- a/arn/User_test.go +++ b/arn/User_test.go @@ -1,18 +1,17 @@ package arn_test import ( - "strings" "testing" + "github.com/akyoto/assert" "github.com/animenotifier/notify.moe/arn" - "github.com/stretchr/testify/assert" ) func TestNewUser(t *testing.T) { user := arn.NewUser() assert.NotNil(t, user) - assert.NotEmpty(t, user.ID) + assert.NotEqual(t, user.ID, "") } func TestDatabaseErrorMessages(t *testing.T) { @@ -20,6 +19,5 @@ func TestDatabaseErrorMessages(t *testing.T) { // We need to make sure that non-existent records return "not found" in the error message. assert.NotNil(t, err) - assert.NotEmpty(t, err.Error()) - assert.NotEqual(t, -1, strings.Index(err.Error(), "not found")) + assert.Contains(t, err.Error(), "not found") } diff --git a/arn/autocorrect/AutoCorrect_test.go b/arn/autocorrect/AutoCorrect_test.go index b023d32f..4247fbdb 100644 --- a/arn/autocorrect/AutoCorrect_test.go +++ b/arn/autocorrect/AutoCorrect_test.go @@ -3,8 +3,8 @@ package autocorrect_test import ( "testing" + "github.com/akyoto/assert" "github.com/animenotifier/notify.moe/arn/autocorrect" - "github.com/stretchr/testify/assert" ) func TestFixUserNick(t *testing.T) { diff --git a/arn/search/Anime_test.go b/arn/search/Anime_test.go index 936e6dba..33262a05 100644 --- a/arn/search/Anime_test.go +++ b/arn/search/Anime_test.go @@ -3,8 +3,8 @@ package search_test import ( "testing" + "github.com/akyoto/assert" "github.com/animenotifier/notify.moe/arn/search" - "github.com/stretchr/testify/assert" ) // Run these search terms and expect the @@ -39,8 +39,8 @@ var tests = map[string]string{ func TestAnimeSearch(t *testing.T) { for term, expectedAnimeID := range tests { results := search.Anime(term, 1) - assert.Len(t, results, 1, "%s -> %s", term, expectedAnimeID) - assert.Equal(t, expectedAnimeID, results[0].ID, "%s -> %s", term, expectedAnimeID) + assert.Equal(t, len(results), 1) + assert.Equal(t, expectedAnimeID, results[0].ID) } } diff --git a/arn/stringutils/StringUtils_test.go b/arn/stringutils/StringUtils_test.go index 322e4c4d..c21d0642 100644 --- a/arn/stringutils/StringUtils_test.go +++ b/arn/stringutils/StringUtils_test.go @@ -3,8 +3,8 @@ package stringutils_test import ( "testing" + "github.com/akyoto/assert" "github.com/animenotifier/notify.moe/arn/stringutils" - "github.com/stretchr/testify/assert" ) func TestRemoveSpecialCharacters(t *testing.T) { diff --git a/arn/validate/Validate_test.go b/arn/validate/Validate_test.go index 02593290..4832be69 100644 --- a/arn/validate/Validate_test.go +++ b/arn/validate/Validate_test.go @@ -3,8 +3,8 @@ package validate_test import ( "testing" + "github.com/akyoto/assert" "github.com/animenotifier/notify.moe/arn/validate" - "github.com/stretchr/testify/assert" ) func TestIsValidNick(t *testing.T) { diff --git a/go.mod b/go.mod index 7147bacb..2099a86f 100644 --- a/go.mod +++ b/go.mod @@ -8,15 +8,15 @@ require ( github.com/aerogo/aero v1.3.21 github.com/aerogo/api v0.2.0 github.com/aerogo/crawler v0.2.5 - github.com/aerogo/flow v0.1.4 - github.com/aerogo/graphql v0.4.0 + github.com/aerogo/flow v0.1.5 + github.com/aerogo/graphql v0.4.1 github.com/aerogo/http v1.0.9 github.com/aerogo/log v0.2.5 github.com/aerogo/manifest v0.1.4 - github.com/aerogo/markdown v0.1.8 - github.com/aerogo/mirror v0.2.3 - github.com/aerogo/nano v0.3.2 - github.com/aerogo/session-store-nano v0.1.5 + github.com/aerogo/markdown v0.1.9 + github.com/aerogo/mirror v0.2.4 + github.com/aerogo/nano v0.3.4 + github.com/aerogo/session-store-nano v0.1.7 github.com/aerogo/sitemap v0.1.3 github.com/akyoto/assert v0.2.0 github.com/akyoto/cache v1.0.2 @@ -56,7 +56,6 @@ require ( github.com/ventu-io/go-shortid v0.0.0-20171029131806-771a37caa5cf github.com/xrash/smetrics v0.0.0-20170218160415-a3153f7040e9 golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 // indirect - golang.org/x/net v0.0.0-20190628185345-da137c7871d7 // indirect golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df diff --git a/go.sum b/go.sum index 7246b79f..87ba2c19 100644 --- a/go.sum +++ b/go.sum @@ -26,6 +26,8 @@ github.com/aerogo/cluster v0.1.6 h1:9HYjJwo19uuh9thIc80T3caap9t9b4BXZ1iN8aztjlU= github.com/aerogo/cluster v0.1.6/go.mod h1:XzYmY5MqNxASmYQWFMh5iCl4tcm1ekReaCQQXVCpJtY= github.com/aerogo/cluster v0.1.7 h1:hMG7oPzYmo4TPtzn4zJc291YzNRrnoSPWSKVaDS4ODA= github.com/aerogo/cluster v0.1.7/go.mod h1:XzYmY5MqNxASmYQWFMh5iCl4tcm1ekReaCQQXVCpJtY= +github.com/aerogo/cluster v0.1.8 h1:N/jU2t7kQfKjXzQIArBQvtNkJCiaP9+jgdEid3P2Omc= +github.com/aerogo/cluster v0.1.8/go.mod h1:ldxff0R9VPbm1yoZdkCrVYWroflgmwh+g6EM8+jFXyE= github.com/aerogo/crawler v0.2.5 h1:tsaRViwBKNJAotzjEmGOln7quzka4f0goiEZVg4Fdxc= github.com/aerogo/crawler v0.2.5/go.mod h1:nyFPwxOFm3gy5cvif8rG1ogXO0fTDVrxsQHwicJz1F8= github.com/aerogo/csp v0.1.6 h1:C2OpzPZHY1S5H+Dz0Or+YgVSfXT36avJw9e1smrIWUY= @@ -36,8 +38,12 @@ github.com/aerogo/flow v0.1.2 h1:fZ3V7Bo7jwBjqnM1mWxYbg5O/FlQX2XovzMZU2D+o5M= github.com/aerogo/flow v0.1.2/go.mod h1:xXIb7GY0AKouhbp4/ViCsiOmvvgRGonqPG30d6FnACI= github.com/aerogo/flow v0.1.4 h1:BCb+nF58tj41xx3aJcxCLsNcGzZH6CGrodRMOIXYfOE= github.com/aerogo/flow v0.1.4/go.mod h1:xXIb7GY0AKouhbp4/ViCsiOmvvgRGonqPG30d6FnACI= +github.com/aerogo/flow v0.1.5 h1:wmSzIpHKV63CUsQ/YaLBti/5csUj1toK8jGvM+0z/fg= +github.com/aerogo/flow v0.1.5/go.mod h1:kG63T/cHB2uR0nu0SGvy8d49J6YuI6LP1IehkP7VtwM= github.com/aerogo/graphql v0.4.0 h1:b5OyqzMNdskH6cKxRCLG6hKEpNYKCpxuad3tLjodox8= github.com/aerogo/graphql v0.4.0/go.mod h1:yAY/KPoBejdN41JUGyK50pPZexFcGp//UMk/GjxqjZc= +github.com/aerogo/graphql v0.4.1 h1:i+W8km/V51bwu3UyvzoKmzxpRv08z6BUJOGGDW8J/lQ= +github.com/aerogo/graphql v0.4.1/go.mod h1:4SvpVsDtDo3q8sI6cAoqlPJd7TuqZjw71TbhCsKMQjo= github.com/aerogo/http v1.0.3 h1:vf6A+Igme5OHQPaP3a00uPDS0oxsx3puMA23d1NsWDM= github.com/aerogo/http v1.0.3/go.mod h1:B1igUmMLpE6KabMpc9reHCJJNUOJ2U/PR9s1fF3TpPQ= github.com/aerogo/http v1.0.6 h1:+aswlcWlUxjVcokF8hUjNJmGIEZuhbFbHi8uSadEvtc= @@ -54,18 +60,26 @@ github.com/aerogo/manifest v0.1.4 h1:JGRMJAANtgzhygMCMov6WgIRkiVuMgP3a+ossf//TJU github.com/aerogo/manifest v0.1.4/go.mod h1:3SvBzx0rCDNQ+C779aEj5ZyP0YWwdGPeEzsPM3VIOzg= github.com/aerogo/markdown v0.1.8 h1:X/FlyuBqdVaFflggxDbXcqGCQNInLKwU/tvyNhg+mQw= github.com/aerogo/markdown v0.1.8/go.mod h1:8+ZWJnLT2rxY75TEd/Y5+rV89Sw9NOh5WiGSjptGNYk= +github.com/aerogo/markdown v0.1.9 h1:Z/t4JcFuFdWWq8PkaZ7ivQU1cSffbGai9NffRwM2zmU= +github.com/aerogo/markdown v0.1.9/go.mod h1:NLjIcQHG8N6b9BsfQnOzLPLu3liPvMeuYwq2TrZ5Dhs= github.com/aerogo/mirror v0.2.3 h1:mV4Bse2o2HiRN7rNntE6mOtWQLiLgTLkIrlt9vUoPD8= github.com/aerogo/mirror v0.2.3/go.mod h1:Un87Jq8RIRrb2bU1CxVToJjVZgSMLUQXxVLCXln4rUU= +github.com/aerogo/mirror v0.2.4 h1:FOCoRC4ncZaMvGal6Cfg8hW7zvFSg/kSUlg4l2r9BEs= +github.com/aerogo/mirror v0.2.4/go.mod h1:pdFnS9P1APNFcULbuT6QaMCuTCa0to4W4rHm6ymkELY= github.com/aerogo/nano v0.2.1 h1:YDGytzYoswid2x8cR5yAc9TmjgR+wEMF8+HowR1UCKI= github.com/aerogo/nano v0.2.1/go.mod h1:1xgPREJH6aW5sE91AwYkvxMDg5YCbAaIYpAL7T1+JgA= github.com/aerogo/nano v0.3.2 h1:1JWaZX8e+dtKZuPWC7Ls1AuzN33auCw7hPjZ8JCjjjE= github.com/aerogo/nano v0.3.2/go.mod h1:o86DA68cpXx5inh8tygTJBF+8sXQ0eoOm36NHIN86YI= +github.com/aerogo/nano v0.3.4 h1:Wk0eRHvsnjni6ROScIo9bRpyuME8ZtgnQwpTi0xbc2M= +github.com/aerogo/nano v0.3.4/go.mod h1:OVx7/5zHvieZH4CO5YksGUVOrA+aVGh1TjnqzA73jTQ= github.com/aerogo/packet v0.1.5 h1:+J9VyVGlXnmaynukktwc7d+/nGxX7hBSNSj/7X8tg90= github.com/aerogo/packet v0.1.5/go.mod h1:/t25yF9WG8B5/QB7wTiHLqwCEQ+nAze7uNm/JJNDQbQ= github.com/aerogo/packet v0.1.6 h1:P9TwEV9xcyWxsjQQAXDfM3jItX4xEqRFNGXWMqH9j3Q= github.com/aerogo/packet v0.1.6/go.mod h1:/t25yF9WG8B5/QB7wTiHLqwCEQ+nAze7uNm/JJNDQbQ= github.com/aerogo/packet v0.1.7 h1:k/gBdAX/yecGW2xWJXt6dpg4Jb84xZScRPExt2rW+hY= github.com/aerogo/packet v0.1.7/go.mod h1:/t25yF9WG8B5/QB7wTiHLqwCEQ+nAze7uNm/JJNDQbQ= +github.com/aerogo/packet v0.2.0 h1:YipWaCqHLn73WP+fU85a6yl6GULlUHWyy+ATmcm7pog= +github.com/aerogo/packet v0.2.0/go.mod h1:8+cOKIJ35ZJAi8Afd94ed6q8D0eq3KeJFxXUEgTxPY0= github.com/aerogo/session v0.1.4 h1:4OgQyUm3wxSsjNRReZhYdHX8X5lXnFp1W+M3EXr4a3E= github.com/aerogo/session v0.1.4/go.mod h1:aM3FUclBU+wt8kwSs3leTByuaBu0sXrw4P+HwKVkSSw= github.com/aerogo/session v0.1.5 h1:x8r+WVyBb6NOsuFMCiiwPO9FEMldoRFS8XfPprA6H2w= @@ -78,6 +92,8 @@ github.com/aerogo/session-store-memory v0.1.6 h1:CZFuEkhL1NV4EFSwerPokuYHtYDXreP github.com/aerogo/session-store-memory v0.1.6/go.mod h1:k3ElPubm0b+V/DV+pgtCLSArro/jbdS7niJ8uTKkvAQ= github.com/aerogo/session-store-nano v0.1.5 h1:klabo+Hyh1GKhpYJExdGvXDxNCxW7sSJevFGGzIqVCo= github.com/aerogo/session-store-nano v0.1.5/go.mod h1:HEm80cLszsfh7yUsX1zbddznPhz2sPWhsHRXNLo9tJs= +github.com/aerogo/session-store-nano v0.1.7 h1:HYxYlt7Z9IOk7xF4OjZjd+rNJxoJwUdgrR5q4Ps1Ac4= +github.com/aerogo/session-store-nano v0.1.7/go.mod h1:WELja1ZnEBAerXGXIJf/vfAFcfo7GW8VBPYIqhdUiQ4= github.com/aerogo/sitemap v0.1.3 h1:HjiyvMCFvoB8a8Lm1+3LaA6B5EeP/f5CChrsAYjAFSQ= github.com/aerogo/sitemap v0.1.3/go.mod h1:/1NT13qIsTm/ydlZHEMd8m014E2yyQkI5coimmIfqc0= github.com/akyoto/assert v0.1.3/go.mod h1:g5e6ag+ksCEQENq/LnmU9z04wCAIFDr8KacBusVL0H8= @@ -344,6 +360,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859 h1:R/3boaszxrf1GEUWTVDzSKVwL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190628185345-da137c7871d7 h1:rTIdg5QFRR7XCaK4LCjBiPbx8j4DQRpdYMnGn/bJUEU= golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA= +golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= diff --git a/patches/email-notification/email-notification.go b/patches/email-notification/email-notification.go deleted file mode 100644 index 37575512..00000000 --- a/patches/email-notification/email-notification.go +++ /dev/null @@ -1,23 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/animenotifier/notify.moe/arn" - "github.com/animenotifier/notify.moe/arn/mailer" -) - -func main() { - notification := &arn.PushNotification{ - Title: "Boku dake ga Inai Machi", - Message: "Episode 16 has been released!", - Icon: "https://media.notify.moe/images/anime/large/11110.webp", - Link: "https://notify.moe/anime/11110", - } - - err := mailer.SendEmailNotification("e.urbach@gmail.com", notification) - - if err != nil { - fmt.Println(err) - } -}