forked from sup-heliotrope/sup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix old malformed tag URI syntax before loading YAML
Fixes sup-heliotrope#577.
- Loading branch information
Showing
2 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
class TestSupAdd < Minitest::Test | ||
|
||
def setup | ||
@path = Dir.mktmpdir | ||
end | ||
|
||
def teardown | ||
FileUtils.rm_r @path | ||
end | ||
|
||
def test_can_add_maildir_source | ||
assert system({"SUP_BASE" => @path}, "bin/sup-add", "maildir:///some/path") | ||
|
||
generated_sources_yaml = File.read "#{@path}/sources.yaml" | ||
assert_equal <<EOS, generated_sources_yaml | ||
--- | ||
- !<tag:supmua.org,2006-10-01/Redwood/Maildir> | ||
uri: maildir:///some/path | ||
usual: true | ||
archived: false | ||
sync_back: true | ||
id: 1 | ||
labels: [] | ||
EOS | ||
end | ||
|
||
def test_fixes_old_tag_uri_syntax | ||
File.write "#{@path}/sources.yaml", <<EOS | ||
--- | ||
- !supmua.org,2006-10-01/Redwood/Maildir | ||
uri: maildir:/some/path | ||
usual: true | ||
archived: false | ||
sync_back: true | ||
id: 1 | ||
labels: [] | ||
EOS | ||
assert system({"SUP_BASE" => @path}, "bin/sup-add", "maildir:///other/path") | ||
|
||
generated_sources_yaml = File.read "#{@path}/sources.yaml" | ||
assert_equal <<EOS, generated_sources_yaml | ||
--- | ||
- !<tag:supmua.org,2006-10-01/Redwood/Maildir> | ||
uri: maildir:/some/path | ||
usual: true | ||
archived: false | ||
sync_back: true | ||
id: 1 | ||
labels: [] | ||
- !<tag:supmua.org,2006-10-01/Redwood/Maildir> | ||
uri: maildir:///other/path | ||
usual: true | ||
archived: false | ||
sync_back: true | ||
id: 2 | ||
labels: [] | ||
EOS | ||
end | ||
|
||
end |