renamed project

This commit is contained in:
danilo silva 2020-06-08 21:37:11 +00:00
parent 579cc97bab
commit f7a5054de7
44 changed files with 155 additions and 155 deletions

View file

@ -55,4 +55,4 @@ RUN chown -R app: ./prod
USER app
# Run the Phoenix app
CMD ["./prod/rel/podcast_feed/bin/podcast_feed", "start"]
CMD ["./prod/rel/openpod/bin/openpod", "start"]

View file

@ -7,18 +7,18 @@
# General application configuration
use Mix.Config
config :podcast_feed,
ecto_repos: [PodcastFeed.Repo]
config :openpod,
ecto_repos: [Openpod.Repo]
# Configures the endpoint
config :podcast_feed, PodcastFeedWeb.Endpoint,
config :openpod, OpenpodWeb.Endpoint,
url: [host: "localhost"],
secret_key_base: "SWl0xVj8AVXoc2G0eUk6VfeOd/lppjkaKbiHWs4ucxAUJ8+wzAEa4bMo0ZVjtVVk",
render_errors: [view: PodcastFeedWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: PodcastFeed.PubSub,
render_errors: [view: OpenpodWeb.ErrorView, accepts: ~w(html json), layout: false],
pubsub_server: Openpod.PubSub,
live_view: [signing_salt: "6jHv46Xw"]
config :podcast_feed,
config :openpod,
cache_duration: :timer.hours(24)
# Configures Elixir's Logger

View file

@ -1,10 +1,10 @@
use Mix.Config
# Configure your database
config :podcast_feed, PodcastFeed.Repo,
config :openpod, Openpod.Repo,
username: "postgres",
password: "postgres",
database: "podcast_feed_dev",
database: "openpod_dev",
hostname: "localhost",
show_sensitive_data_on_connection_error: true,
pool_size: 10
@ -15,7 +15,7 @@ config :podcast_feed, PodcastFeed.Repo,
# The watchers configuration can be used to run external
# watchers to your application. For example, we use it
# with webpack to recompile .js and .css sources.
config :podcast_feed, PodcastFeedWeb.Endpoint,
config :openpod, OpenpodWeb.Endpoint,
http: [port: 5000],
debug_errors: true,
code_reloader: true,
@ -55,13 +55,13 @@ config :podcast_feed, PodcastFeedWeb.Endpoint,
# different ports.
# Watch static and templates for browser reloading.
config :podcast_feed, PodcastFeedWeb.Endpoint,
config :openpod, OpenpodWeb.Endpoint,
live_reload: [
patterns: [
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$",
~r"priv/gettext/.*(po)$",
~r"lib/podcast_feed_web/(live|views)/.*(ex)$",
~r"lib/podcast_feed_web/templates/.*(eex)$"
~r"lib/openpod_web/(live|views)/.*(ex)$",
~r"lib/openpod_web/templates/.*(eex)$"
]
]

View file

@ -9,7 +9,7 @@ use Mix.Config
# manifest is generated by the `mix phx.digest` task,
# which you should run after static files are built and
# before starting your production server.
config :podcast_feed, PodcastFeedWeb.Endpoint,
config :openpod, OpenpodWeb.Endpoint,
load_from_system_env: true,
url: [scheme: "https", host: "other-unwilling-barasinga.gigalixirapp.com", port: 443],
http: [port: {:system, "PORT"}],
@ -19,7 +19,7 @@ config :podcast_feed, PodcastFeedWeb.Endpoint,
version: Application.spec(:phoenix_distillery, :vsn)
# force_ssl: [rewrite_on: [:x_forwarded_proto]]
config :podcast_feed,
config :openpod,
cache_duration: :timer.hours(24)
# Do not print debug messages in production
@ -30,7 +30,7 @@ config :logger, level: :info
# To get SSL working, you will need to add the `https` key
# to the previous section and set your `:url` port to 443:
#
# config :podcast_feed, PodcastFeedWeb.Endpoint,
# config :openpod, OpenpodWeb.Endpoint,
# ...
# url: [host: "example.com", port: 443],
# https: [
@ -54,7 +54,7 @@ config :logger, level: :info
# We also recommend setting `force_ssl` in your endpoint, ensuring
# no data is ever sent via http, always redirecting to https:
#
# config :podcast_feed, PodcastFeedWeb.Endpoint,
# config :openpod, OpenpodWeb.Endpoint,
# force_ssl: [hsts: true]
#
# Check `Plug.SSL` for all available options in `force_ssl`.

View file

@ -4,7 +4,7 @@ secret_key_base = System.fetch_env!("SECRET_KEY_BASE")
application_port = System.fetch_env!("APP_PORT")
application_host = System.fetch_env!("APP_HOST")
config :podcast_feed, PodcastFeedWeb.Endpoint,
config :openpod, OpenpodWeb.Endpoint,
url: [scheme: "http", host: application_host, port: String.to_integer(application_port)],
http: [:inet6, port: String.to_integer(application_port)],
secret_key_base: secret_key_base

View file

@ -5,16 +5,16 @@ use Mix.Config
# The MIX_TEST_PARTITION environment variable can be used
# to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information.
# config :podcast_feed, PodcastFeed.Repo,
# config :openpod, Openpod.Repo,
# username: "postgres",
# password: "postgres",
# database: "podcast_feed_test#{System.get_env("MIX_TEST_PARTITION")}",
# database: "openpod_test#{System.get_env("MIX_TEST_PARTITION")}",
# hostname: "localhost",
# pool: Ecto.Adapters.SQL.Sandbox
# We don't run a server during test. If one is required,
# you can enable the server option below.
config :podcast_feed, PodcastFeedWeb.Endpoint,
config :openpod, OpenpodWeb.Endpoint,
http: [port: 4002],
server: false

View file

@ -1,12 +1,12 @@
defmodule PodcastFeed do
defmodule Openpod do
@moduledoc """
PodcastFeed keeps the contexts that define your domain
Openpod keeps the contexts that define your domain
and business logic.
Contexts are also responsible for managing your data, regardless
if it comes from the database, an external API or others.
"""
alias PodcastFeed.Provider.Archive
alias Openpod.Provider.Archive
def archive(identifier) do
Archive.Parser.by_identifier(identifier)

View file

@ -1,4 +1,4 @@
defmodule PodcastFeed.Application do
defmodule Openpod.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
@ -15,25 +15,25 @@ defmodule PodcastFeed.Application do
# Start the dynamic supervisor in order to dynamically start podcast cache
{DynamicSupervisor, [name: @archive_supervisor, strategy: :one_for_one]},
# Start the Telemetry supervisor
PodcastFeedWeb.Telemetry,
OpenpodWeb.Telemetry,
# Start the PubSub system
{Phoenix.PubSub, name: PodcastFeed.PubSub},
{Phoenix.PubSub, name: Openpod.PubSub},
# Start the Endpoint (http/https)
PodcastFeedWeb.Endpoint
# Start a worker by calling: PodcastFeed.Worker.start_link(arg)
# {PodcastFeed.Worker, arg}
OpenpodWeb.Endpoint
# Start a worker by calling: Openpod.Worker.start_link(arg)
# {Openpod.Worker, arg}
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: PodcastFeed.Supervisor]
opts = [strategy: :one_for_one, name: Openpod.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
PodcastFeedWeb.Endpoint.config_change(changed, removed)
OpenpodWeb.Endpoint.config_change(changed, removed)
:ok
end
end

View file

@ -1,10 +1,10 @@
defmodule PodcastFeed.Boundary.ArchiveServer do
defmodule Openpod.Boundary.ArchiveServer do
@moduledoc false
use GenServer, restart: :temporary
require Logger
alias PodcastFeed
alias PodcastFeed.Provider.Archive
alias Openpod
alias Openpod.Provider.Archive
@registry :podcast_registry
@archive_supervisor :archive_supervisor
@ -44,7 +44,7 @@ defmodule PodcastFeed.Boundary.ArchiveServer do
def handle_call(:get_feed, _from, feed) do
Logger.debug "retrieve cached feed data for #{feed[:identifier]}..."
{:reply, feed[:feed_data], feed, Application.fetch_env!(:podcast_feed, :cache_duration)}
{:reply, feed[:feed_data], feed, Application.fetch_env!(:openpod, :cache_duration)}
end
def handle_call(:reload, _from, feed) do

View file

@ -1,10 +1,10 @@
defmodule PodcastFeed.Provider.Archive.Parser do
defmodule Openpod.Provider.Archive.Parser do
@moduledoc """
This module provides a public API for fetching data from archive.org and convert them
in a common podcast data structures.
"""
alias PodcastFeed.Utility.Format
alias Openpod.Utility.Format
alias __MODULE__
@archive_metadata_url "http://archive.org/metadata/{identifier}"
@ -29,10 +29,10 @@ defmodule PodcastFeed.Provider.Archive.Parser do
def by_identifier(identifier) do
%Parser{identifier: identifier}
|> enrich_with_archive_metadata()
|> to_podcast_feed_data()
|> to_openpod_data()
end
def to_podcast_feed_data(token) do
def to_openpod_data(token) do
%{
podcast: podcast_data(token),
items: items_data(token)

View file

@ -1,4 +1,4 @@
defmodule PodcastFeed.Utility.Format do
defmodule Openpod.Utility.Format do
@moduledoc """
This module provides utility to format a string
"""

View file

@ -1,12 +1,12 @@
defmodule PodcastFeedWeb do
defmodule OpenpodWeb do
@moduledoc """
The entrypoint for defining your web interface, such
as controllers, views, channels and so on.
This can be used in your application as:
use PodcastFeedWeb, :controller
use PodcastFeedWeb, :view
use OpenpodWeb, :controller
use OpenpodWeb, :view
The definitions below will be executed for every view,
controller, etc, so keep them short and clean, focused
@ -19,19 +19,19 @@ defmodule PodcastFeedWeb do
def controller do
quote do
use Phoenix.Controller, namespace: PodcastFeedWeb
use Phoenix.Controller, namespace: OpenpodWeb
import Plug.Conn
import PodcastFeedWeb.Gettext
alias PodcastFeedWeb.Router.Helpers, as: Routes
import OpenpodWeb.Gettext
alias OpenpodWeb.Router.Helpers, as: Routes
end
end
def view do
quote do
use Phoenix.View,
root: "lib/podcast_feed_web/templates",
namespace: PodcastFeedWeb
root: "lib/openpod_web/templates",
namespace: OpenpodWeb
# Import convenience functions from controllers
import Phoenix.Controller,
@ -54,7 +54,7 @@ defmodule PodcastFeedWeb do
def channel do
quote do
use Phoenix.Channel
import PodcastFeedWeb.Gettext
import OpenpodWeb.Gettext
end
end
@ -66,9 +66,9 @@ defmodule PodcastFeedWeb do
# Import basic rendering functionality (render, render_layout, etc)
import Phoenix.View
import PodcastFeedWeb.ErrorHelpers
import PodcastFeedWeb.Gettext
alias PodcastFeedWeb.Router.Helpers, as: Routes
import OpenpodWeb.ErrorHelpers
import OpenpodWeb.Gettext
alias OpenpodWeb.Router.Helpers, as: Routes
end
end

View file

@ -1,8 +1,8 @@
defmodule PodcastFeedWeb.UserSocket do
defmodule OpenpodWeb.UserSocket do
use Phoenix.Socket
## Channels
# channel "room:*", PodcastFeedWeb.RoomChannel
# channel "room:*", OpenpodWeb.RoomChannel
# Socket params are passed from the client and can
# be used to verify and authenticate a user. After
@ -27,7 +27,7 @@ defmodule PodcastFeedWeb.UserSocket do
# Would allow you to broadcast a "disconnect" event and terminate
# all active sockets and channels for a given user:
#
# PodcastFeedWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
# OpenpodWeb.Endpoint.broadcast("user_socket:#{user.id}", "disconnect", %{})
#
# Returning `nil` makes this socket anonymous.
@impl true

View file

@ -1,6 +1,6 @@
defmodule PodcastFeedWeb.FeedController do
use PodcastFeedWeb, :controller
alias PodcastFeed.Boundary.ArchiveServer
defmodule OpenpodWeb.FeedController do
use OpenpodWeb, :controller
alias Openpod.Boundary.ArchiveServer
def by_identifier(conn, %{"identifier" => identifier, "reload" => _}) do
do_by_identifier(conn, identifier, fn -> ArchiveServer.reload(identifier) end)

View file

@ -0,0 +1,7 @@
defmodule OpenpodWeb.PageController do
use OpenpodWeb, :controller
def index(conn, _params) do
render(conn, "index.html")
end
end

View file

@ -1,16 +1,16 @@
defmodule PodcastFeedWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :podcast_feed
defmodule OpenpodWeb.Endpoint do
use Phoenix.Endpoint, otp_app: :openpod
# The session will be stored in the cookie and signed,
# this means its contents can be read but not tampered with.
# Set :encryption_salt if you would also like to encrypt it.
@session_options [
store: :cookie,
key: "_podcast_feed_key",
key: "_openpod_key",
signing_salt: "kxzln5AX"
]
socket "/socket", PodcastFeedWeb.UserSocket,
socket "/socket", OpenpodWeb.UserSocket,
websocket: true,
longpoll: false
@ -22,7 +22,7 @@ defmodule PodcastFeedWeb.Endpoint do
# when deploying your static files in production.
plug Plug.Static,
at: "/",
from: :podcast_feed,
from: :openpod,
gzip: false,
only: ~w(css fonts images js favicon.ico robots.txt)
@ -32,7 +32,7 @@ defmodule PodcastFeedWeb.Endpoint do
socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket
plug Phoenix.LiveReloader
plug Phoenix.CodeReloader
# plug Phoenix.Ecto.CheckRepoStatus, otp_app: :podcast_feed
# plug Phoenix.Ecto.CheckRepoStatus, otp_app: :openpod
end
plug Phoenix.LiveDashboard.RequestLogger,
@ -50,5 +50,5 @@ defmodule PodcastFeedWeb.Endpoint do
plug Plug.MethodOverride
plug Plug.Head
plug Plug.Session, @session_options
plug PodcastFeedWeb.Router
plug OpenpodWeb.Router
end

View file

@ -1,11 +1,11 @@
defmodule PodcastFeedWeb.Gettext do
defmodule OpenpodWeb.Gettext do
@moduledoc """
A module providing Internationalization with a gettext-based API.
By using [Gettext](https://hexdocs.pm/gettext),
your module gains a set of macros for translations, for example:
import PodcastFeedWeb.Gettext
import OpenpodWeb.Gettext
# Simple translation
gettext("Here is the string to translate")
@ -20,5 +20,5 @@ defmodule PodcastFeedWeb.Gettext do
See the [Gettext Docs](https://hexdocs.pm/gettext) for detailed usage.
"""
use Gettext, otp_app: :podcast_feed
use Gettext, otp_app: :openpod
end

View file

@ -1,5 +1,5 @@
defmodule PodcastFeedWeb.Router do
use PodcastFeedWeb, :router
defmodule OpenpodWeb.Router do
use OpenpodWeb, :router
pipeline :browser do
plug :accepts, ["html"]
@ -13,14 +13,14 @@ defmodule PodcastFeedWeb.Router do
plug :accepts, ["json"]
end
scope "/podcast", PodcastFeedWeb do
scope "/podcast", OpenpodWeb do
pipe_through :browser
get "/:identifier", FeedController, :by_identifier
end
# Other scopes may use custom stacks.
# scope "/api", PodcastFeedWeb do
# scope "/api", OpenpodWeb do
# pipe_through :api
# end
@ -36,7 +36,7 @@ defmodule PodcastFeedWeb.Router do
scope "/" do
pipe_through :browser
live_dashboard "/dashboard", metrics: PodcastFeedWeb.Telemetry
live_dashboard "/dashboard", metrics: OpenpodWeb.Telemetry
end
end
end

View file

@ -1,4 +1,4 @@
defmodule PodcastFeedWeb.Telemetry do
defmodule OpenpodWeb.Telemetry do
use Supervisor
import Telemetry.Metrics
@ -31,11 +31,11 @@ defmodule PodcastFeedWeb.Telemetry do
),
# Database Metrics
summary("podcast_feed.repo.query.total_time", unit: {:native, :millisecond}),
summary("podcast_feed.repo.query.decode_time", unit: {:native, :millisecond}),
summary("podcast_feed.repo.query.query_time", unit: {:native, :millisecond}),
summary("podcast_feed.repo.query.queue_time", unit: {:native, :millisecond}),
summary("podcast_feed.repo.query.idle_time", unit: {:native, :millisecond}),
summary("openpod.repo.query.total_time", unit: {:native, :millisecond}),
summary("openpod.repo.query.decode_time", unit: {:native, :millisecond}),
summary("openpod.repo.query.query_time", unit: {:native, :millisecond}),
summary("openpod.repo.query.queue_time", unit: {:native, :millisecond}),
summary("openpod.repo.query.idle_time", unit: {:native, :millisecond}),
# VM Metrics
summary("vm.memory.total", unit: {:byte, :kilobyte}),
@ -49,7 +49,7 @@ defmodule PodcastFeedWeb.Telemetry do
[
# A module, function and arguments to be invoked periodically.
# This function must call :telemetry.execute/3 and a metric must be added above.
# {PodcastFeedWeb, :count_users, []}
# {OpenpodWeb, :count_users, []}
]
end
end

View file

@ -21,7 +21,7 @@
<itunes:keywords><%= @podcast.keywords |> Enum.join(", ") %></itunes:keywords>
<itunes:explicit><![CDATA[<%= @podcast.explicit %>]]></itunes:explicit>
<itunes:image href="<%= @podcast.image.url %>" />
<atom:link href="<%= PodcastFeedWeb.Endpoint.url <> Routes.feed_path(@conn, :by_identifier, @identifier) %>" rel="self" type="application/rss+xml" />
<atom:link href="<%= OpenpodWeb.Endpoint.url <> Routes.feed_path(@conn, :by_identifier, @identifier) %>" rel="self" type="application/rss+xml" />
<pubDate><%= @podcast.pubDate |> Calendar.DateTime.Format.rfc2822 %></pubDate>
<title><![CDATA[<%= @podcast.title %>]]></title>
<itunes:author><![CDATA[<%= @podcast.owner.name %>]]></itunes:author>

View file

@ -4,7 +4,7 @@
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>PodcastFeed · Phoenix Framework</title>
<title>Openpod · Phoenix Framework</title>
<link rel="stylesheet" href="<%= Routes.static_path(@conn, "/css/app.css") %>"/>
<script defer type="text/javascript" src="<%= Routes.static_path(@conn, "/js/app.js") %>"></script>
</head>

View file

@ -1,4 +1,4 @@
defmodule PodcastFeedWeb.ErrorHelpers do
defmodule OpenpodWeb.ErrorHelpers do
@moduledoc """
Conveniences for translating and building error messages.
"""
@ -39,9 +39,9 @@ defmodule PodcastFeedWeb.ErrorHelpers do
# should be written to the errors.po file. The :count option is
# set by Ecto and indicates we should also apply plural rules.
if count = opts[:count] do
Gettext.dngettext(PodcastFeedWeb.Gettext, "errors", msg, msg, count, opts)
Gettext.dngettext(OpenpodWeb.Gettext, "errors", msg, msg, count, opts)
else
Gettext.dgettext(PodcastFeedWeb.Gettext, "errors", msg, opts)
Gettext.dgettext(OpenpodWeb.Gettext, "errors", msg, opts)
end
end
end

View file

@ -1,5 +1,5 @@
defmodule PodcastFeedWeb.ErrorView do
use PodcastFeedWeb, :view
defmodule OpenpodWeb.ErrorView do
use OpenpodWeb, :view
# If you want to customize a particular status code
# for a certain format, you may uncomment below.

View file

@ -1,5 +1,5 @@
defmodule PodcastFeedWeb.FeedView do
use PodcastFeedWeb, :view
defmodule OpenpodWeb.FeedView do
use OpenpodWeb, :view
def format_length(length) do
min = length / 60 |> trunc()

View file

@ -0,0 +1,3 @@
defmodule OpenpodWeb.LayoutView do
use OpenpodWeb, :view
end

View file

@ -0,0 +1,3 @@
defmodule OpenpodWeb.PageView do
use OpenpodWeb, :view
end

View file

@ -1,7 +0,0 @@
defmodule PodcastFeedWeb.PageController do
use PodcastFeedWeb, :controller
def index(conn, _params) do
render(conn, "index.html")
end
end

View file

@ -1,3 +0,0 @@
defmodule PodcastFeedWeb.LayoutView do
use PodcastFeedWeb, :view
end

View file

@ -1,3 +0,0 @@
defmodule PodcastFeedWeb.PageView do
use PodcastFeedWeb, :view
end

View file

@ -1,9 +1,9 @@
defmodule PodcastFeed.MixProject do
defmodule Openpod.MixProject do
use Mix.Project
def project do
[
app: :podcast_feed,
app: :openpod,
version: "0.1.0",
elixir: "~> 1.10",
elixirc_paths: elixirc_paths(Mix.env()),
@ -21,7 +21,7 @@ defmodule PodcastFeed.MixProject do
# Type `mix help compile.app` for more information.
def application do
[
mod: {PodcastFeed.Application, []},
mod: {Openpod.Application, []},
extra_applications: [:logger, :runtime_tools, :elixir_xml_to_map]
]
end

View file

@ -5,7 +5,7 @@
# Inside the script, you can read and write to any of your
# repositories directly:
#
# PodcastFeed.Repo.insert!(%PodcastFeed.SomeSchema{})
# Openpod.Repo.insert!(%Openpod.SomeSchema{})
#
# We recommend using the bang functions (`insert!`, `update!`
# and so on) as they will fail if something goes wrong.

View file

@ -1,7 +1,7 @@
defmodule PodcastFeed.Provider.Archive.ParserTest do
defmodule Openpod.Provider.Archive.ParserTest do
use ExUnit.Case
alias PodcastFeed.Provider.Archive.Parser
alias Openpod.Provider.Archive.Parser
setup_all do
json_metadata = "{\"created\":1590247789,\"d1\":\"ia601402.us.archive.org\",\"d2\":\"ia801402.us.archive.org\",\"dir\":\"/8/items/incontri-a-piano-terra\",\"files\":[{\"name\": \"metadata.json\",\"source\": \"original\",\"mtime\": \"1590258296\",\"size\": \"315\",\"md5\": \"a0c0e219cf3f13e54f2a4b3efef8e5c8\",\"crc32\": \"2d181b5c\",\"sha1\": \"8244b579a759edddd01c905dd11f8565e83d0898\",\"format\": \"JSON\"},{\"name\": \"cover.jpg\",\"source\": \"original\",\"mtime\": \"1590258445\",\"size\": \"10650\",\"md5\": \"15687b23e11f0099abbfe64eb1685c31\",\"crc32\": \"fbb1516a\",\"sha1\": \"98fa929c7554241cfa92bea8eba69b39c5d47603\",\"format\": \"JPEG\",\"rotation\": \"0\"},{\"name\":\"Confini mobili sulle alpi.mp3\",\"source\":\"original\",\"mtime\":\"1590135989\",\"size\":\"46933494\",\"md5\":\"e832ee9381a4f8af2d9727e2f49126ae\",\"crc32\":\"d709dd90\",\"sha1\":\"89c820a2dfd63cfbbf7aeefd191c653756b33fe3\",\"format\":\"VBR MP3\",\"length\":\"3902.35\",\"height\":\"0\",\"width\":\"0\",\"title\":\"Confini mobili sulle alpi (italian limes)\",\"creator\":\"APE Milano\",\"album\":\"Incontri a Piano Terra\",\"track\":\"02\",\"artist\":\"APE Milano\",\"genre\":\"podcast\"},{\"name\":\"Confini mobili sulle alpi.png\",\"source\":\"derivative\",\"format\":\"PNG\",\"original\":\"Confini mobili sulle alpi.mp3\",\"mtime\":\"1590137809\",\"size\":\"34656\",\"md5\":\"63893f9b00402a107682b5317e808523\",\"crc32\":\"b59ff609\",\"sha1\":\"a396716431cd0acedd243030093d0b31d792cfb3\"},{\"name\":\"Confini mobili sulle alpi_spectrogram.png\",\"source\":\"derivative\",\"format\":\"Spectrogram\",\"original\":\"Confini mobili sulle alpi.mp3\",\"mtime\":\"1590137854\",\"size\":\"273188\",\"md5\":\"557337665c6d9f962b2e91d169f25e1b\",\"crc32\":\"08b4b57c\",\"sha1\":\"88e088f9c4954aa8f0849b7e0d69cee8d7d42327\"}],\"files_count\":31,\"item_last_updated\":1590160774,\"item_size\":244544362,\"metadata\":{\"identifier\":\"incontri-a-piano-terra\",\"mediatype\":\"audio\",\"collection\":\"opensource_audio\",\"creator\":\"APE Milano\",\"description\":\"Qualche registrazione delle attivit\\u00e0 sociali che promuoviamo al Piano Terra di Milano\",\"language\":\"ita\",\"licenseurl\":\"https://creativecommons.org/licenses/by-nc-nd/4.0/\",\"scanner\":\"Internet Archive HTML5 Uploader 1.6.4\",\"subject\":[\"ape milano\",\"podcast\",\"montagna\"],\"title\":\"Incontri a Piano Terra\",\"uploader\":\"milanoape@gmail.com\",\"publicdate\":\"2020-05-22 08:30:21\",\"addeddate\":\"2020-05-22 08:30:21\",\"curation\":\"[curator]validator@archive.org[/curator][date]20200522085526[/date][comment]checked for malware[/comment]\",\"op_link\":\"http://www.ape-alveare.it/\",\"op_category\":\"Montagna\",\"op_explicit\":\"no\"},\"server\":\"ia601402.us.archive.org\",\"uniq\":122833277,\"workable_servers\":[\"ia601402.us.archive.org\",\"ia801402.us.archive.org\"]}"
@ -15,7 +15,7 @@ defmodule PodcastFeed.Provider.Archive.ParserTest do
end
test "podcast data are correctly converted", state do
%{podcast: podcast} = Parser.to_podcast_feed_data(state[:token])
%{podcast: podcast} = Parser.to_openpod_data(state[:token])
assert %{
title: "Incontri a Piano Terra",
@ -44,7 +44,7 @@ defmodule PodcastFeed.Provider.Archive.ParserTest do
test "podcast subject metadata can also be a string", state do
token = state[:token] |> Map.update!(:archive_metadata, fn metadata -> put_in(metadata, ["metadata", "subject"], "foo;bar;baz") end)
%{podcast: podcast} = Parser.to_podcast_feed_data(token)
%{podcast: podcast} = Parser.to_openpod_data(token)
assert %{
keywords: ["foo", "bar", "baz"],
@ -52,7 +52,7 @@ defmodule PodcastFeed.Provider.Archive.ParserTest do
end
test "items data are correctly converted", state do
%{items: items} = Parser.to_podcast_feed_data(state[:token])
%{items: items} = Parser.to_openpod_data(state[:token])
assert [
%{

View file

@ -1,7 +1,7 @@
defmodule PodcastFeed.Utility.FormatTest do
defmodule Openpod.Utility.FormatTest do
use ExUnit.Case
alias PodcastFeed.Utility.Format
alias Openpod.Utility.Format
test "Test placeholder are replaced" do
assert "http://foo/bar" == Format.compile("http://{host}/{path}", host: "foo", path: "bar")

View file

@ -1,5 +1,5 @@
defmodule PodcastFeedWeb.PageControllerTest do
use PodcastFeedWeb.ConnCase
defmodule OpenpodWeb.PageControllerTest do
use OpenpodWeb.ConnCase
# test "GET /", %{conn: conn} do
# conn = get(conn, "/")

View file

@ -0,0 +1,14 @@
defmodule OpenpodWeb.ErrorViewTest do
use OpenpodWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
test "renders 404.html" do
assert render_to_string(OpenpodWeb.ErrorView, "404.html", []) == "Not Found"
end
test "renders 500.html" do
assert render_to_string(OpenpodWeb.ErrorView, "500.html", []) == "Internal Server Error"
end
end

View file

@ -1,5 +1,5 @@
defmodule PodcastFeedWeb.LayoutViewTest do
use PodcastFeedWeb.ConnCase, async: true
defmodule OpenpodWeb.LayoutViewTest do
use OpenpodWeb.ConnCase, async: true
# When testing helpers, you may want to import Phoenix.HTML and
# use functions such as safe_to_string() to convert the helper

View file

@ -0,0 +1,3 @@
defmodule OpenpodWeb.PageViewTest do
use OpenpodWeb.ConnCase, async: true
end

View file

@ -1,14 +0,0 @@
defmodule PodcastFeedWeb.ErrorViewTest do
use PodcastFeedWeb.ConnCase, async: true
# Bring render/3 and render_to_string/3 for testing custom views
import Phoenix.View
test "renders 404.html" do
assert render_to_string(PodcastFeedWeb.ErrorView, "404.html", []) == "Not Found"
end
test "renders 500.html" do
assert render_to_string(PodcastFeedWeb.ErrorView, "500.html", []) == "Internal Server Error"
end
end

View file

@ -1,3 +0,0 @@
defmodule PodcastFeedWeb.PageViewTest do
use PodcastFeedWeb.ConnCase, async: true
end

View file

@ -1,4 +1,4 @@
defmodule PodcastFeedWeb.ChannelCase do
defmodule OpenpodWeb.ChannelCase do
@moduledoc """
This module defines the test case to be used by
channel tests.
@ -11,7 +11,7 @@ defmodule PodcastFeedWeb.ChannelCase do
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use PodcastFeedWeb.ChannelCase, async: true`, although
by setting `use OpenpodWeb.ChannelCase, async: true`, although
this option is not recommended for other databases.
"""
@ -21,18 +21,18 @@ defmodule PodcastFeedWeb.ChannelCase do
quote do
# Import conveniences for testing with channels
import Phoenix.ChannelTest
import PodcastFeedWeb.ChannelCase
import OpenpodWeb.ChannelCase
# The default endpoint for testing
@endpoint PodcastFeedWeb.Endpoint
@endpoint OpenpodWeb.Endpoint
end
end
setup tags do
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(PodcastFeed.Repo)
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(Openpod.Repo)
# unless tags[:async] do
# Ecto.Adapters.SQL.Sandbox.mode(PodcastFeed.Repo, {:shared, self()})
# Ecto.Adapters.SQL.Sandbox.mode(Openpod.Repo, {:shared, self()})
# end
:ok

View file

@ -1,4 +1,4 @@
defmodule PodcastFeedWeb.ConnCase do
defmodule OpenpodWeb.ConnCase do
@moduledoc """
This module defines the test case to be used by
tests that require setting up a connection.
@ -11,7 +11,7 @@ defmodule PodcastFeedWeb.ConnCase do
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use PodcastFeedWeb.ConnCase, async: true`, although
by setting `use OpenpodWeb.ConnCase, async: true`, although
this option is not recommended for other databases.
"""
@ -22,20 +22,20 @@ defmodule PodcastFeedWeb.ConnCase do
# Import conveniences for testing with connections
import Plug.Conn
import Phoenix.ConnTest
import PodcastFeedWeb.ConnCase
import OpenpodWeb.ConnCase
alias PodcastFeedWeb.Router.Helpers, as: Routes
alias OpenpodWeb.Router.Helpers, as: Routes
# The default endpoint for testing
@endpoint PodcastFeedWeb.Endpoint
@endpoint OpenpodWeb.Endpoint
end
end
setup tags do
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(PodcastFeed.Repo)
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(Openpod.Repo)
# unless tags[:async] do
# Ecto.Adapters.SQL.Sandbox.mode(PodcastFeed.Repo, {:shared, self()})
# Ecto.Adapters.SQL.Sandbox.mode(Openpod.Repo, {:shared, self()})
# end
{:ok, conn: Phoenix.ConnTest.build_conn()}

View file

@ -1,4 +1,4 @@
defmodule PodcastFeed.DataCase do
defmodule Openpod.DataCase do
@moduledoc """
This module defines the setup for tests requiring
access to the application's data layer.
@ -10,7 +10,7 @@ defmodule PodcastFeed.DataCase do
we enable the SQL sandbox, so changes done to the database
are reverted at the end of every test. If you are using
PostgreSQL, you can even run database tests asynchronously
by setting `use PodcastFeed.DataCase, async: true`, although
by setting `use Openpod.DataCase, async: true`, although
this option is not recommended for other databases.
"""
@ -18,20 +18,20 @@ defmodule PodcastFeed.DataCase do
using do
quote do
alias PodcastFeed.Repo
alias Openpod.Repo
# import Ecto
# import Ecto.Changeset
# import Ecto.Query
import PodcastFeed.DataCase
import Openpod.DataCase
end
end
setup tags do
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(PodcastFeed.Repo)
# :ok = Ecto.Adapters.SQL.Sandbox.checkout(Openpod.Repo)
# unless tags[:async] do
# Ecto.Adapters.SQL.Sandbox.mode(PodcastFeed.Repo, {:shared, self()})
# Ecto.Adapters.SQL.Sandbox.mode(Openpod.Repo, {:shared, self()})
# end
:ok

View file

@ -1,2 +1,2 @@
ExUnit.start()
# Ecto.Adapters.SQL.Sandbox.mode(PodcastFeed.Repo, :manual)
# Ecto.Adapters.SQL.Sandbox.mode(Openpod.Repo, :manual)