mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-01-22 23:08:50 +08:00
8c91a1f788
Co-authored-by: José Valim <jose.valim@dashbit.co>
30 lines
757 B
Elixir
30 lines
757 B
Elixir
defmodule Livebook.Hubs.TeamTest do
|
|
use Livebook.TeamsIntegrationCase, async: true
|
|
|
|
alias Livebook.Hubs.Provider
|
|
|
|
describe "stamping" do
|
|
test "generates and verifies stamp for a notebook", %{user: user, node: node} do
|
|
team = create_team_hub(user, node)
|
|
|
|
notebook_source = """
|
|
# Team notebook
|
|
|
|
# Intro
|
|
|
|
```elixir
|
|
IO.puts("Hello!")
|
|
```
|
|
"""
|
|
|
|
metadata = %{"key" => "value"}
|
|
|
|
assert {:ok, stamp} = Provider.notebook_stamp(team, notebook_source, metadata)
|
|
|
|
assert {:ok, ^metadata} = Provider.verify_notebook_stamp(team, notebook_source, stamp)
|
|
|
|
assert {:error, :invalid} =
|
|
Provider.verify_notebook_stamp(team, notebook_source <> "change\n", stamp)
|
|
end
|
|
end
|
|
end
|