1
0
Fork 0
forked from github/pelican
Commit graph

27 commits

Author SHA1 Message Date
derwinlu
5389543a39 improve URLWrapper comparison
* speed up via reduced slugify calls (only call when needed)
* fix __repr__ to not contain str, should call repr on name
* add test_urlwrappers and move URLWrappers tests there
  * add new equality test
* cleanup header

additionally:
* Content is now decorated with python_2_unicode_compatible
  instead of treating __str__ differently
* better formatting for test_article_metadata_key_lowercase
  to actually output the conflict instead of a non descriptive
  error
2015-06-27 19:13:50 +02:00
derwinlu
e3f5e39e17 fix outdated content_object_init refs
* remove content_object_init section from docs
* improve content_object_init test

The content_object_init signal used to set its class as sender and pass
the instance as additional arg in 6100773. Commit ed907b4 removed this
behaviour to bring it inline with other signals, on the basis that
you can test for the class of the object anyway.
We also had a test in place, checking this behaviour, but it was poorly
implemented, not actually checking if the function ever got called.

closes #1711
2015-06-12 19:23:17 +02:00
Deniz Turgut
3ea4542015 Make sure Content uses URLWrappers 2015-03-06 16:06:20 -05:00
George V. Reilly
4c25610cd8 Fix Pelican rendering and unit tests on Windows.
* Fix {filename} links on Windows.
  Otherwise '{filename}/foo/bar.jpg' doesn't work
* Clean up relative Posix path handling in contents.
* Use Posix paths in readers
* Environment for Popen must be strs, not unicodes.
* Ignore Git CRLF warnings.
* Replace CRLFs with LFs in inputs on Windows.
* Fix importer tests
* Fix test_contents
* Fix one last backslash in paginated output
* Skip the remaining failing locale tests on Windows.
* Document the use of forward slashes on Windows.
* Add some Fabric and ghp-import notes
2015-01-25 17:42:53 -08:00
Elana Hashman
49668f711a Generate {tag}-style links on pages correctly. Fixes #1513 2015-01-02 01:20:57 -07:00
Forest
d503ea436c Let documents {attach} static files. Fixes #1019.
Until now, making static files end up in the same output directory as an
article that links to them has been difficult, especially when the article's
output path is generated based on metadata. This changeset introduces the
{attach} link syntax, which works like the {filename} syntax, but also
overrides the static file's output path with the directory of the
linking document.

It also clarifies and expands the documentation on linking to internal content.
2014-11-04 12:45:16 -08:00
Ondrej Grover
3f6b130d6e Fix #1198, enable custom locale in template rendering, fixes links
reverts getpelican/pelican@ddcccfeaa9

If one used a locale that made use of unicode characters (like fr_FR.UTF-8)
the files on disk would be in correct locale while links would be to C.

Uses a SafeDatetime class that works with unicode format strigns
by using custom strftime to prevent ascii decoding errors with Python2.

Also added unicode decoding for the calendar module to fix period
archives.
2014-06-26 00:00:19 -04:00
Antoine Brenner
7277c95fb5 Make sure locale is what we want before/after the tests
The locale is a global state, and it was not properly reset to
whatever it was before the unitttest possibly changed it.
This is now fixed.

Not restoring the locale led to weird issues: depending on
the order chosen by "python -m unittest discover" to run
the unit tests, some tests would apparently randomly fail
due to the locale not being what was expected.

For example, test_period_in_timeperiod_archive would
call mock('posts/1970/ 1月/index.html',...) instead of
expected mock('posts/1970/Jan/index.html',...) and fail.
2014-04-15 16:45:45 +02:00
Antoine Brenner
03976b650d Fix unittest issue related to python2/python3 differences
The test_datetime test passed on python3 but not python2 because
datetime.strftime is a byte string in python2, and a unicode string in python3

This patch allows the test to pass in both python2 and python3 (3.3+ only)
2014-04-14 20:43:19 +02:00
th3aftermath
56b0061393 Add the setting SLUGIFY_ATTRIBUTE 2014-03-04 21:16:23 -05:00
Anatoly Bubenkov
2c25e488c4 multiple authors implemented 2014-02-14 03:21:06 +01:00
Alistair Magee
dc552bb869 fix test-suite import error 2014-01-10 16:33:02 +00:00
Kyle Fuller
da690dfc37 Python-Markdown quote's URL's, we need to unquote to use on filesystem
Fixes #1143
Closes #1095
Closes #1149
2013-12-09 18:13:43 +00:00
zhouji
e538aa2cde Fine-tune url-value HTML attributes list. 2013-10-17 11:33:34 +08:00
Tshepang Lekhonkhobe
67d3ab8883 assertEquals is deprecated in favor of assertEqual 2013-10-06 16:15:43 +02:00
Honza Javorek
6ed23fec7d Tuned the tests so they are PY3 compilant. 2013-09-25 16:31:23 +02:00
Honza Javorek
7415d370e6 Added tests. 2013-09-25 16:13:28 +02:00
Alexis Métaireau
e2ca6d7608 Add categories and tags to the replacement mechanism. 2013-08-17 17:36:13 +02:00
Nick Moore
9b7ae20aa9 test for author & category slugification 2013-07-15 00:22:05 +10:00
W. Trevor King
c8e7d95b34 tests.support: Use kwargs overrides in get_settings()
This avoids harcoding test-specific overrides, and makes it easy to
setup a settings dictionary based on DEFAULT_CONFIG for testing.
Because you can trust Pelican to use settings based on DEFAULT_CONFIG,
you are free to go about using:

  settings[my_key]

instead of:

  settings.get(my_key, some_fallback)

or:

  if my_key in settings:
      ...

if you know that `my_key` is in DEFAULT_CONFIG.
2013-06-02 14:24:27 -04:00
W. Trevor King
e9dc1dd478 settings: Make DEFAULT_CONFIG public
This dictionary is accessed by plugins (like `summary`) which add new
settings, so it should be public (i.e. no prefixed underscore).

The changed name length would have led to a re-indenting of the
default contents anyway, so I shifted them all to four spaces.
2013-06-02 13:32:10 -04:00
Deniz Turgut
9af62414db Fixes #708 SUMMARY_MAX_LENGTH=0 should return empty string 2013-04-26 19:37:31 -04:00
Alexis Métaireau
547f8d2e83 Move the tests into pelican. Fix #500 2013-03-06 00:41:27 -08:00
Mario Rodas
3cd84ab396 moving tests dir 2011-07-02 14:41:39 -05:00
Alexis Metaireau
371892ceaa Merge branch tests into main. (See #44)
Conflicts:
	pelican/contents.py
	pelican/settings.py
	samples/pelican.conf.py
2011-05-10 23:18:11 +01:00
Alexis Metaireau
c13c707a62 Tests for contents.py 2011-01-13 00:32:37 +01:00
Alexis Metaireau
bb96e253c9 Start working on the testsuite. 2011-01-05 16:24:44 +01:00