Skip to content

Commit 1b812ed

Browse files
committed
Loosen API key format assertion to is_binary + byte_size > 0
1 parent c87401b commit 1b812ed

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test/hex/api_test.exs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ defmodule Hex.APITest do
7373

7474
assert {:ok, {201, _, %{"secret" => key_a}}} = Hex.API.Key.new("key_a", permissions, auth)
7575
assert {:ok, {201, _, %{"secret" => key_b}}} = Hex.API.Key.new("key_b", permissions, auth)
76-
assert byte_size(key_a) == 32
77-
assert byte_size(key_b) == 32
76+
assert is_binary(key_a) and byte_size(key_a) > 0
77+
assert is_binary(key_b) and byte_size(key_b) > 0
7878
auth = [key: key_a]
7979

8080
Hexpm.new_package("hexpm", "melon", "0.0.1", %{}, %{}, auth)
@@ -91,8 +91,8 @@ defmodule Hex.APITest do
9191
auth = [user: "user", pass: "hunter42"]
9292
assert {:ok, {201, _, %{"secret" => key_c}}} = Hex.API.Key.new("key_c", permissions, auth)
9393
assert {:ok, {201, _, %{"secret" => key_d}}} = Hex.API.Key.new("key_d", permissions, auth)
94-
assert byte_size(key_c) == 32
95-
assert byte_size(key_d) == 32
94+
assert is_binary(key_c) and byte_size(key_c) > 0
95+
assert is_binary(key_d) and byte_size(key_d) > 0
9696
auth_c = [key: key_c]
9797
auth_d = [key: key_d]
9898

0 commit comments

Comments
 (0)