Skip to content

Commit 8f2b6ce

Browse files
committed
Merge pull request #26 from mdorman/cask
Moving to Cask as a development environment.
2 parents 90d6c73 + 808ea26 commit 8f2b6ce

File tree

11 files changed

+455
-420
lines changed

11 files changed

+455
-420
lines changed

.ert-runner

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-l test/test-helper.el

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.cask

Cask

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(source melpa)
2+
(source org)
3+
4+
(package-file "org-blog.el")
5+
6+
(development
7+
(depends-on "el-mock")
8+
(depends-on "ert-runner")
9+
(depends-on "f"))

acceptance

Lines changed: 0 additions & 3 deletions
This file was deleted.

org-blog-buffer.el

Lines changed: 0 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -165,139 +165,3 @@ update the buffer to reflect the values it contains."
165165
(copy-alist merge)
166166
(lambda (a b)
167167
(string< (car b) (car a)))))))))
168-
169-
;;;; Declare tests if ert is loaded
170-
(when (featurep 'ert)
171-
(ert-deftest ob-test-extract-from-empty ()
172-
"Try extracting a post from an empty buffer."
173-
(should
174-
(equal (with-temp-buffer
175-
(org-blog-buffer-extract-post))
176-
nil)))
177-
178-
(ert-deftest ob-test-extract-from-buffer ()
179-
"Try extracting a post from a buffer with stuff set."
180-
(should
181-
(equal (with-temp-buffer
182-
(insert "\
183-
#+POST_BLOG: t1b
184-
#+POST_CATEGORY: t1c1, t1c2
185-
#+DATE: [2013-01-25 Fri 00:00]
186-
#+DESCRIPTION: t1e
187-
#+POST_ID: 1
188-
#+KEYWORDS: t1k1, t1k2, t1k3
189-
#+POST_LINK: http://example.com/
190-
#+POST_NAME: t1n
191-
#+TITLE: Test 1 Title
192-
#+POST_TYPE: post
193-
194-
Just a little bit of content.
195-
There is still part of the paragraph. Line breaks are refolded.
196-
197-
#+BEGIN_VERSE
198-
Though the material in verse should
199-
retain
200-
its line
201-
breaks
202-
#+END_VERSE
203-
204-
[[org-blog-buffer.el][There's a link in here, too]]")
205-
(org-blog-buffer-extract-post))
206-
'((:blog . "t1b")
207-
(:category "t1c1" "t1c2")
208-
(:content . "<p>Just a little bit of content. There is still part of the paragraph. Line breaks are refolded.</p><p class=\"verse\">Though the material in verse should<br />retain<br />its line<br />breaks<br /></p><p><a href=\"org-blog-buffer.el\">There's a link in here, too</a></p>")
209-
(:date 20738 4432)
210-
(:description . "t1e")
211-
(:id . "1")
212-
(:keywords "t1k1" "t1k2" "t1k3")
213-
(:link . "http://example.com/")
214-
(:name . "t1n")
215-
(:title . "Test 1 Title")
216-
(:type . "post")))))
217-
218-
(ert-deftest ob-test-merge-from-empty ()
219-
"Try merging an empty post into an empty buffer."
220-
(should
221-
(equal (with-temp-buffer
222-
(org-blog-buffer-merge-post '((:blog)
223-
(:category)
224-
(:content)
225-
(:date)
226-
(:description)
227-
(:id)
228-
(:keywords)
229-
(:link)
230-
(:name)
231-
(:parent)
232-
(:status)
233-
(:title)
234-
(:type)))
235-
(buffer-string))
236-
"")))
237-
238-
(ert-deftest ob-test-merge-from-full ()
239-
"Try merging a full post into an empty buffer."
240-
(should
241-
(equal (with-temp-buffer
242-
(org-blog-buffer-merge-post '((:blog . "t1b")
243-
(:category "t1c1" "t1c2")
244-
(:date 20738 4432)
245-
(:description . "t1e")
246-
(:id . "1")
247-
(:keywords "t1k1" "t1k2" "t1k3")
248-
(:link . "http://example.com/")
249-
(:name . "t1n")
250-
(:parent . "0")
251-
(:status . "publish")
252-
(:title . "Test 1 Title")
253-
(:type . "post")))
254-
(buffer-string))
255-
"\
256-
#+POST_BLOG: t1b
257-
#+POST_CATEGORY: t1c1, t1c2
258-
#+DATE: [2013-01-25 Fri 00:00]
259-
#+DESCRIPTION: t1e
260-
#+POST_ID: 1
261-
#+KEYWORDS: t1k1, t1k2, t1k3
262-
#+POST_LINK: http://example.com/
263-
#+POST_NAME: t1n
264-
#+POST_PARENT: 0
265-
#+POST_STATUS: publish
266-
#+TITLE: Test 1 Title
267-
#+POST_TYPE: post
268-
")))
269-
270-
(ert-deftest ob-test-merge-round-trip ()
271-
"Try merging a full post into a full buffer, and make sure
272-
you get the same thing out."
273-
(with-temp-buffer
274-
(let ((post-string "#+POST_BLOG: t2b
275-
#+POST_CATEGORY: t2c1, t2c2
276-
#+DATE: [2013-01-25 Fri 00:00]
277-
#+DESCRIPTION: t2e
278-
#+POST_ID: 1
279-
#+KEYWORDS: t2k1, t2k2, t2k3
280-
#+POST_LINK: http://example.com/
281-
#+POST_NAME: t2n
282-
#+POST_PARENT: 0
283-
#+POST_STATUS: publish
284-
#+TITLE: Test 2 Title
285-
#+POST_TYPE: post
286-
")
287-
(post-struct '((:blog . "t2b")
288-
(:category "t2c1" "t2c2")
289-
(:date 20738 4432)
290-
(:description . "t2e")
291-
(:id . "1")
292-
(:keywords "t2k1" "t2k2" "t2k3")
293-
(:link . "http://example.com/")
294-
(:name . "t2n")
295-
(:parent . "0")
296-
(:status . "publish")
297-
(:title . "Test 2 Title")
298-
(:type . "post"))))
299-
(org-blog-buffer-merge-post post-struct)
300-
(should (equal (buffer-string) post-string))
301-
(should (equal (org-blog-buffer-extract-post) post-struct))
302-
(org-blog-buffer-merge-post post-struct)
303-
(should (equal (buffer-string) post-string))))))

org-blog-wp.el

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -257,138 +257,3 @@ call the specified function and return the results."
257257
post-id
258258
(org-blog-post-to-wp post))
259259
post-id)
260-
261-
;;;; Define tests if ert is loaded
262-
(when (featurep 'ert)
263-
(ert-deftest ob-test-post-to-wp ()
264-
"Transfer from buffers to posts and back again"
265-
(let ((post1-struct '((:blog . "t1b")
266-
(:category "t1c1" "t1c2")
267-
(:content . "<p>\nTest 1 Content</p>\n")
268-
(:date 20738 4432)
269-
(:description . "t1e")
270-
(:id . "1")
271-
(:keywords "t1k1" "t1k2" "t1k3")
272-
(:link . "http://example.com/")
273-
(:name . "t1n")
274-
(:parent . "0")
275-
(:status . "publish")
276-
(:title . "Test 1 Title")
277-
(:type . "post")))
278-
(post1-wp-input '(("link" . "http://example.com/")
279-
("post_content" . "<p>\nTest 1 Content</p>\n")
280-
("post_date_gmt" :datetime (20738 22432 0 0))
281-
("post_excerpt" . "t1e")
282-
("post_id" . "1")
283-
("post_name" . "t1n")
284-
("post_parent" . "0")
285-
("post_status" . "publish")
286-
("post_title" . "Test 1 Title")
287-
("post_type" . "post")
288-
("terms_names"
289-
("category" "t1c1" "t1c2")
290-
("post_tag" "t1k1" "t1k2" "t1k3")))))
291-
(should (equal (org-blog-post-to-wp post1-struct) post1-wp-input))))
292-
(ert-deftest ob-test-wp-to-post ()
293-
"Transform from a WP response to a post"
294-
(let ((post1-struct '((:blog . "t1b")
295-
(:category "t1c1" "t1c2")
296-
(:content . "<p>\nTest 1 Content</p>\n")
297-
(:date 20738 4432)
298-
(:description . "t1e")
299-
(:id . "1")
300-
(:keywords "t1k1" "t1k2" "t1k3")
301-
(:link . "http://example.com/")
302-
(:name . "t1n")
303-
(:parent . "0")
304-
(:status . "publish")
305-
(:title . "Test 1 Title")
306-
(:type . "post")))
307-
(post1-wp-output '(("post_id" . "1")
308-
("post_title" . "Test 1 Title")
309-
("post_date" :datetime
310-
(20738 4432))
311-
("post_date_gmt" :datetime
312-
(20738 4432))
313-
("post_modified" :datetime
314-
(20738 4432))
315-
("post_modified_gmt" :datetime
316-
(20738 4432))
317-
("post_status" . "publish")
318-
("post_type" . "post")
319-
("post_name" . "t1n")
320-
("post_author" . "3075621")
321-
("post_password")
322-
("post_excerpt" . "t1e")
323-
("post_content" . "<p>\nTest 1 Content</p>\n")
324-
("post_parent" . "0")
325-
("post_mime_type")
326-
("link" . "http://example.com/")
327-
("guid" . "http://example.com/")
328-
("menu_order" . 0)
329-
("comment_status" . "closed")
330-
("ping_status" . "open")
331-
("sticky")
332-
("post_thumbnail")
333-
("post_format" . "standard")
334-
("terms"
335-
(("term_id" . "126039325")
336-
("name" . "t1c1")
337-
("slug" . "t1c1")
338-
("term_group" . "0")
339-
("term_taxonomy_id" . "4")
340-
("taxonomy" . "category")
341-
("description")
342-
("parent" . "0")
343-
("count" . 0))
344-
(("term_id" . "126039469")
345-
("name" . "t1c2")
346-
("slug" . "t1c2")
347-
("term_group" . "0")
348-
("term_taxonomy_id" . "5")
349-
("taxonomy" . "category")
350-
("description")
351-
("parent" . "0")
352-
("count" . 0))
353-
(("term_id" . "147991082")
354-
("name" . "t1k1")
355-
("slug" . "t1k1")
356-
("term_group" . "0")
357-
("term_taxonomy_id" . "6")
358-
("taxonomy" . "post_tag")
359-
("description")
360-
("parent" . "0")
361-
("count" . 0))
362-
(("term_id" . "147991085")
363-
("name" . "t1k2")
364-
("slug" . "t1k2")
365-
("term_group" . "0")
366-
("term_taxonomy_id" . "7")
367-
("taxonomy" . "post_tag")
368-
("description")
369-
("parent" . "0")
370-
("count" . 0))
371-
(("term_id" . "147991087")
372-
("name" . "t1k3")
373-
("slug" . "t1k3")
374-
("term_group" . "0")
375-
("term_taxonomy_id" . "8")
376-
("taxonomy" . "post_tag")
377-
("description")
378-
("parent" . "0")
379-
("count" . 0)))
380-
("custom_fields"))))
381-
;; FIXME: we should actually be looking up :blog in the alist
382-
(should (equal (cons (cons :blog "t1b") (org-blog-wp-to-post post1-wp-output)) post1-struct))))
383-
384-
(ert-deftest ob-test-wp-params ()
385-
"Test getting the blog-id (and correct xmlrpc URL) via xmlrpc"
386-
(let ((initial-blog-param `((:xmlrpc . "https://wordpress.com/xmlrpc.php")
387-
(:username . "mdorman@ironicdesign.com")
388-
(:password . ,org-blog-test-password)))
389-
(final-blog-param `((:blog-id . "46183217")
390-
(:engine . "wp")
391-
(:password . ,org-blog-test-password)
392-
(:username . "mdorman@ironicdesign.com")
393-
(:xmlrpc . "https://orgblogtest.wordpress.com/xmlrpc.php"))))
394-
(should (equal (org-blog-wp-params initial-blog-param) final-blog-param)))))

0 commit comments

Comments
 (0)