[people]
""",
"`milestones` table is missing")
+ check_error(
+ """
+ bugzilla_url = ""
+ [people."person1"]
+ """,
+ "`output_markdown_file` field is missing in person entry for "
+ "'person1'")
+ check_error(
+ """
+ bugzilla_url = ""
+ [people."person1"]
+ output_markdown_file = 1
+ """,
+ "`output_markdown_file` field in person entry for 'person1' must "
+ "be a string")
check(
"""
bugzilla_url = ""
[milestones]
[people."person1"]
aliases = ["a"]
+ output_markdown_file = "person1.mdwn"
[people."person2"]
aliases = ["b"]
+ output_markdown_file = "person2.mdwn"
""",
"Config(bugzilla_url='', people={"
"'person1': Person(config=..., identifier='person1', "
+ "output_markdown_file='person1.mdwn', "
"aliases={'a'}, email=None), "
"'person2': Person(config=..., identifier='person2', "
+ "output_markdown_file='person2.mdwn', "
"aliases={'b'}, email=None)}, milestones={})")
check_error(
"""
bugzilla_url = ""
[people."person1"]
email = 123
+ output_markdown_file = "person1.mdwn"
""",
"`email` field in person entry for 'person1' must be a string")
check(
[milestones]
[people."person1"]
email = "email@example.com"
+ output_markdown_file = "person1.mdwn"
""",
"Config(bugzilla_url='', people={"
"'person1': Person(config=..., identifier='person1', "
+ "output_markdown_file='person1.mdwn', "
"aliases=set(), email='email@example.com')}, milestones={})")
check_error(
"""
bugzilla_url = ""
[people."person1"]
blah = 123
+ output_markdown_file = "person1.mdwn"
""",
"unknown field in person entry for 'person1': `blah`")
check_error(
bugzilla_url = ""
[milestones]
[people."person1"]
+ output_markdown_file = "person1.mdwn"
[people."person2"]
aliases = ["person1"]
+ output_markdown_file = "person2.mdwn"
""",
"alias is not allowed to be the same as any person's identifier: "
"in person entry for 'person2': 'person1' is also the identifier "
bugzilla_url = ""
[milestones]
[people."person1"]
+ output_markdown_file = "person1.mdwn"
aliases = ["a"]
[people."person2"]
aliases = ["a"]
+ output_markdown_file = "person2.mdwn"
""",
"alias is not allowed to be the same as another person's alias: "
"in person entry for 'person2': 'a' is also an alias for person "
[milestones]
[people."person1"]
aliases = ["person1_alias1", "alias1"]
+ output_markdown_file = "person1.mdwn"
[people."person2"]
aliases = ["person2_alias2", "alias2"]
+ output_markdown_file = "person2.mdwn"
""")
person1 = config.people['person1']
person2 = config.people['person2']
2: milestone2,
})
+ def test_bugzilla_url_stripped(self):
+ c = Config.from_str(
+ """
+ bugzilla_url = "https://bugzilla.example.com/prefix"
+ [people]
+ [milestones]
+ """
+ )
+ self.assertEqual(c.bugzilla_url_stripped,
+ "https://bugzilla.example.com/prefix")
+ c = Config.from_str(
+ """
+ bugzilla_url = "https://bugzilla.example.com/prefix/"
+ [people]
+ [milestones]
+ """
+ )
+ self.assertEqual(c.bugzilla_url_stripped,
+ "https://bugzilla.example.com/prefix")
+ c = Config.from_str(
+ """
+ bugzilla_url = "https://bugzilla.example.com/"
+ [people]
+ [milestones]
+ """
+ )
+ self.assertEqual(c.bugzilla_url_stripped,
+ "https://bugzilla.example.com")
+
def test_from_file(self):
def load(text):
with io.StringIO(text) as file:
[people."person1"]
email = "person1@example.com"
aliases = ["alias1"]
+ output_markdown_file = "person1.mdwn"
[milestones]
"Milestone 1" = { canonical_bug_id = 123 }
""")),
"Config(bugzilla_url='https://bugzilla.example.com/', "
"people={'person1': Person(config=..., identifier='person1', "
+ "output_markdown_file='person1.mdwn', "
"aliases={'alias1'}, email='person1@example.com')}, "
"milestones={'Milestone 1': Milestone(config=..., "
"identifier='Milestone 1', canonical_bug_id=123)})")