Fix tests. Remove oembed template
authorraeno <just.raeno@gmail.com>
Fri, 14 Dec 2018 01:59:33 +0000 (02:59 +0100)
committerraeno <just.raeno@gmail.com>
Fri, 14 Dec 2018 02:00:50 +0000 (03:00 +0100)
lib/pleroma/web/templates/o_embed/note.xml.eex [deleted file]
test/web/ostatus/ostatus_controller_test.exs

diff --git a/lib/pleroma/web/templates/o_embed/note.xml.eex b/lib/pleroma/web/templates/o_embed/note.xml.eex
deleted file mode 100644 (file)
index e814a4c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<oembed>
-    <version>1.0</version>
-    <type>link</type>
-    <author_name>raeno</author_name>
-    <author_url>http://iamcal.com/</author_url>
-    <cache_age>86400</cache_age>
-    <provider_name>iamcal.com</provider_name>
-    <provider_url>http://iamcal.com/</provider_url>
-</oembed>
\ No newline at end of file
index 560305c15ff713bf305c9746d3430bec6adcb4e5..747e3015401a24bae1a18ce8a3b83652af8081c2 100644 (file)
@@ -84,6 +84,7 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
 
     conn =
       conn
+      |> put_req_header("accept", "application/xml")
       |> get(url)
 
     expected =
@@ -110,11 +111,12 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
     |> response(404)
   end
 
-  test "gets an activity", %{conn: conn} do
+  test "gets an activity in xml format", %{conn: conn} do
     note_activity = insert(:note_activity)
     [_, uuid] = hd(Regex.scan(~r/.+\/([\w-]+)$/, note_activity.data["id"]))
 
     conn
+    |> put_req_header("accept", "application/xml")
     |> get("/activities/#{uuid}")
     |> response(200)
   end
@@ -134,7 +136,22 @@ defmodule Pleroma.Web.OStatus.OStatusControllerTest do
     |> response(404)
   end
 
-  test "gets a notice", %{conn: conn} do
+  test "renders notice metatags in html format" do
+    note_activity = insert(:note_activity)
+
+    conn = get(conn, "/notice/#{note_activity.id}")
+
+    twitter_card_summary = "<meta content=\"summary\" property=\"twitter:card\">"
+
+    description_content =
+      "<meta content=\"#{note_activity.data["object"]["content"]}\" property=\"og:description\">"
+
+    body = html_response(conn, 200)
+    assert body =~ twitter_card_summary
+    assert body =~ description_content
+  end
+
+  test "gets a notice in xml format", %{conn: conn} do
     note_activity = insert(:note_activity)
 
     conn