def test_version(self): fix_version = jira_adapter.get_next_release_name_in_project("HOSTDEV") key = jissue(["create", "task", "this is a test", "--fix-version=0.16", "HOSTDEV"]) issue = jira_adapter.get_issue(key) self.assertEquals(jira_adapter.issue_mappings['FixVersions'](issue), ["0.16"]) self.assertEquals(jira_adapter.issue_mappings['Type'](issue), "Task") jira_adapter.resolve_issue(key, 'Not a Bug', fix_version)
def test_component__jish(self): fix_version = jira_adapter.get_next_release_name_in_project("HOSTDEV") key = jissue(["create", "Bug", "this is a test"], dict(JISSUE_COMPONENT="integration-tests", JISSUE_PROJECT="HOSTDEV")) issue = jira_adapter.get_issue(key) self.assertEquals(jira_adapter.issue_mappings['Components'](issue), ["integration-tests"]) jira_adapter.resolve_issue(key, 'Not a Bug', fix_version)
def test_description(self): fix_version = jira_adapter.get_next_release_name_in_project("HOSTDEV") summary, description = "summary goes here", "description goes here" key = jissue(["create", "bug", "{}\n{}".format(summary, description), "HOSTDEV"]) issue = jira_adapter.get_issue(key) self.assertEquals(description, issue.fields().description) jira_adapter.resolve_issue(key, 'Not a Bug', fix_version)
def test_jish_and_file(self): with unstaged_files_context(): execute_assert_success(["git", "add", "foo"]) with open("foo", "w"): pass self.assertEquals(jissue(["commit", "just a message", "--file=foo"], dict(JISSUE_ISSUE="HOSTDEV-955")), 0) self.assertIn("just a message", execute_assert_success("git log", shell=True).get_stdout())
def test_jish_and_short(self): fix_version = jira_adapter.get_next_release_name_in_project("HOSTDEV") with mock_stdout() as stdout: key = jissue(["create", "bug", "this is a test", "--short"], dict(JISSUE_PROJECT="HOSTDEV", JISSUE_COMPONENT="jissue", JISSUE_VERSION=fix_version)) self.assertEquals(key, stdout.getvalue().strip()) jira_adapter.resolve_issue(key, 'Not a Bug', fix_version)
def test_simple(self): with test_issue_context() as issue: self.assertEquals(jissue(["link", "relates", "HOSTDEV-787", issue.key]), 0)
def test_jish(self): with test_issue_context() as issue: self.assertEquals(jissue(["label", "--label=test"], dict(JISSUE_ISSUE=issue.key)), 0)
def test_jish(self, key="HOSTDEV-787"): self.assertEquals(jissue(["show"], dict(JISSUE_ISSUE=key)), 0)
def test_component(self): fix_version = jira_adapter.get_next_release_name_in_project("HOSTDEV") key = jissue(["create", "Bug", "this is a test", "--component=integration-tests", "HOSTDEV"]) issue = jira_adapter.get_issue(key) self.assertEquals(jira_adapter.issue_mappings['Components'](issue), ["integration-tests"]) jira_adapter.resolve_issue(key, 'Not a Bug', fix_version)
def test_additional_flags(self, flag): self.assertEquals(jissue(["search", self.query, flag]), 0)
def test_jish(self): with test_issue_context() as issue: self.assertEquals(jissue(["assign", "--to-me", issue.key]), 0) self.assertEquals(jissue(["start"], dict(JISSUE_ISSUE=issue.key)), 0) self.assertEquals(jissue(["stop"], dict(JISSUE_ISSUE=issue.key)), 0)
def test_automatic(self): with test_issue_context() as issue: self.assertEquals(jissue(["assign", "--automatic", issue.key]), 0)
def test_jish(self): self.assertEquals(jissue(["inventory"], dict(JISSUE_PROJECT="HOSTDEV")), 0)
def test_simple(self): with test_issue_context() as issue: self.assertEquals(jissue(["label", "--label=test", "--label=anothe-test", issue.key]), 0)
def test_simple(self): with unstaged_files_context(): execute_assert_success(["git", "add", "foo"]) self.assertEquals(jissue(["commit", "just a message", "HOSTDEV-955"]), 0) self.assertIn("just a message", execute_assert_success("git log", shell=True).get_stdout())
def test_jish(self): with test_issue_context() as issue: self.assertEquals(jissue(["comment", "just a comment"], dict(JISSUE_ISSUE=issue.key)), 0) with mock_stdout() as stdout: jissue(["show", issue.key]) self.assertIn("just a comment", stdout.getvalue())
def test_simple(self): with test_issue_context() as issue: self.assertEquals(jissue(["comment", "just a comment", issue.key]), 0) with mock_stdout() as stdout: jissue(["show", issue.key]) self.assertIn("just a comment", stdout.getvalue())
def test_requires_key(self): self.assertEquals(jissue(["list"]), 1)
def test_jish(self): with test_issue_context() as issue: self.assertEquals(jissue(["assign", "--assignee=guyr"], dict(JISSUE_ISSUE=issue.key)), 0)
def test_additional_flags(self, flag): self.assertEquals(jissue(["list", "HOSTDEV", flag]), 0)
def test_simple(self): self.assertEquals(jissue(["inventory", "HOSTDEV"]), 0)
def test_commit_fails(self): with unstaged_files_context(): with mock_stderr() as stderr: self.assertEquals(jissue(["commit", "just a message", "HOSTDEV-955"]), 1) self.assertNotEquals(stderr.getvalue(), '')
def test_simple(self): self.assertEquals(jissue(["search", self.query]), 0)
def test_jish(self): with test_issue_context() as issue: self.assertEquals(jissue(["resolve"], dict(JISSUE_ISSUE=issue.key)), 0) raise SkipResolve()
def test_simple(self): with test_issue_context() as issue: self.assertEquals(jissue(["assign", "--to-me", issue.key]), 0) self.assertEquals(jissue(["start", issue.key]), 0) self.assertEquals(jissue(["stop", issue.key]), 0)
def test_simple(self): with test_issue_context() as issue: self.assertEquals(jissue(["resolve", issue.key, "--fix-version", "0.16"]), 0) raise SkipResolve()
def test_simple(self, key): self.assertEquals(jissue(["show", key]), 0)
def test_not_a_bug(self): with test_issue_context() as issue: self.assertEquals(jissue(["resolve", issue.key, "--resolve-as=Not a Bug"]), 0) raise SkipResolve()
def test_jish(self): with test_issue_context() as issue: fix_version = jira_adapter.get_next_release_name_in_project("HOSTDEV") jira_adapter.resolve_issue(issue.key, "Not a Bug", fix_version) self.assertEquals(jissue(["reopen"], dict(JISSUE_ISSUE=issue.key)), 0)
def test_jisk(self): with test_issue_context() as issue: self.assertEquals(jissue(["link", "relates", "HOSTDEV-787"], dict(JISSUE_ISSUE=issue.key)), 0)