From 2ef5712a08b96910cd0f8a4a8ac4ceadb86ecd25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Collin?= Date: Mon, 7 Oct 2019 07:54:51 +0200 Subject: [PATCH] =?UTF-8?q?[MM-19120]=20Migrate=20tests=20from=20"model/se?= =?UTF-8?q?curity=5Fbulletin=5Ftest.go=E2=80=A6=20(#12567)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/security_bulletin_test.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/model/security_bulletin_test.go b/model/security_bulletin_test.go index a6e55fe1c4..356f405127 100644 --- a/model/security_bulletin_test.go +++ b/model/security_bulletin_test.go @@ -4,6 +4,7 @@ package model import ( + "github.com/stretchr/testify/require" "strings" "testing" ) @@ -17,16 +18,12 @@ func TestSecurityBulletinToFromJson(t *testing.T) { j := b.ToJson() b1 := SecurityBulletinFromJson(strings.NewReader(j)) - CheckString(t, b1.AppliesToVersion, b.AppliesToVersion) - CheckString(t, b1.Id, b.Id) + require.Equal(t, b, *b1) // Malformed JSON s2 := `{"wat"` b2 := SecurityBulletinFromJson(strings.NewReader(s2)) - - if b2 != nil { - t.Fatal("expected nil") - } + require.Nil(t, b2) } func TestSecurityBulletinsToFromJson(t *testing.T) { @@ -45,11 +42,11 @@ func TestSecurityBulletinsToFromJson(t *testing.T) { b1 := SecurityBulletinsFromJson(strings.NewReader(j)) - CheckInt(t, len(b1), 2) + require.Len(t, b1, 2) // Malformed JSON s2 := `{"wat"` b2 := SecurityBulletinsFromJson(strings.NewReader(s2)) - CheckInt(t, len(b2), 0) + require.Len(t, b2, 0) }