View Source MyApp.CharonOauth2.TestSeeds (CharonOauth2 v0.5.1)

Insert test values for writing tests. Uses default values described below.

All functions take an overrides parameter that can be used to override the default values. In order to set your own defaults, you can use the CharonOauth2.Config field :test_seed_defaults.

Summary

Functions

insert_test_authorization(overrides \\ [])

@spec insert_test_authorization(keyword() | map()) ::
  {:ok, MyApp.CharonOauth2.Authorization.t()} | {:error, Ecto.Changeset.t()}

Inserts an authorization using Elixir.MyApp.CharonOauth2.Authorizations.insert/1.

The default values can be overridden using overrides. These are the default values:

%{scope: ["read"]}

insert_test_authorization!(overrides \\ [])

@spec insert_test_authorization!(keyword() | map()) ::
  MyApp.CharonOauth2.Authorization.t()

Inserts an authorization using Elixir.MyApp.CharonOauth2.Authorizations.insert/1. Raises on failure.

The default values can be overridden using overrides. These are the default values:

%{scope: ["read"]}

insert_test_client(overrides \\ [])

@spec insert_test_client(keyword() | map()) ::
  {:ok, MyApp.CharonOauth2.Client.t()} | {:error, Ecto.Changeset.t()}

Inserts a client using Elixir.MyApp.CharonOauth2.Clients.insert/1.

The default values can be overridden using overrides. These are the default values:

%{
  description: "Incredibly innovative application that definitely treats your data well.",
  grant_types: ["authorization_code"],
  name: "MyClient",
  redirect_uris: ["https://mysite.tld"],
  scope: ["read"]
}

insert_test_client!(overrides \\ [])

@spec insert_test_client!(keyword() | map()) :: MyApp.CharonOauth2.Client.t()

Inserts a client using Elixir.MyApp.CharonOauth2.Clients.insert/1. Raises on failure.

The default values can be overridden using overrides. These are the default values:

%{
  description: "Incredibly innovative application that definitely treats your data well.",
  grant_types: ["authorization_code"],
  name: "MyClient",
  redirect_uris: ["https://mysite.tld"],
  scope: ["read"]
}

insert_test_grant(overrides \\ [])

@spec insert_test_grant(keyword() | map()) ::
  {:ok, MyApp.CharonOauth2.Grant.t()} | {:error, Ecto.Changeset.t()}

Inserts a grant using Elixir.MyApp.CharonOauth2.Grants.insert/1.

The default values can be overridden using overrides. These are the default values:

%{redirect_uri: "https://mysite.tld", type: "authorization_code"}

insert_test_grant!(overrides \\ [])

@spec insert_test_grant!(keyword() | map()) :: MyApp.CharonOauth2.Grant.t()

Inserts a grant using Elixir.MyApp.CharonOauth2.Grants.insert/1. Raises on failure.

The default values can be overridden using overrides. These are the default values:

%{redirect_uri: "https://mysite.tld", type: "authorization_code"}