Browse Source

When copying a check, also copy the "failure keyword" field Fixes #417

pull/419/head
Pēteris Caune 4 years ago
parent
commit
40f95d5a56
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
3 changed files with 6 additions and 0 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +4
    -0
      hc/front/tests/test_copy.py
  3. +1
    -0
      hc/front/views.py

+ 1
- 0
CHANGELOG.md View File

@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file.
- Handle excessively long email addresses in the signup form - Handle excessively long email addresses in the signup form
- Handle excessively long email addresses in the team member invite form - Handle excessively long email addresses in the team member invite form
- Don't allow duplicate team memberships - Don't allow duplicate team memberships
- When copying a check, also copy the "failure keyword" field (#417)
## v1.16.0 - 2020-08-04 ## v1.16.0 - 2020-08-04


+ 4
- 0
hc/front/tests/test_copy.py View File

@ -7,6 +7,8 @@ class CopyCheckTestCase(BaseTestCase):
super(CopyCheckTestCase, self).setUp() super(CopyCheckTestCase, self).setUp()
self.check = Check(project=self.project) self.check = Check(project=self.project)
self.check.name = "Foo" self.check.name = "Foo"
self.check.subject = "success-keyword"
self.check.subject_fail = "failure-keyword"
self.check.save() self.check.save()
self.copy_url = "/checks/%s/copy/" % self.check.code self.copy_url = "/checks/%s/copy/" % self.check.code
@ -16,6 +18,8 @@ class CopyCheckTestCase(BaseTestCase):
r = self.client.post(self.copy_url, follow=True) r = self.client.post(self.copy_url, follow=True)
self.assertContains(r, "This is a brand new check") self.assertContains(r, "This is a brand new check")
self.assertContains(r, "Foo (copy)") self.assertContains(r, "Foo (copy)")
self.assertContains(r, "success-keyword")
self.assertContains(r, "failure-keyword")
def test_it_obeys_limit(self): def test_it_obeys_limit(self):
self.profile.check_limit = 0 self.profile.check_limit = 0


+ 1
- 0
hc/front/views.py View File

@ -593,6 +593,7 @@ def copy(request, code):
copied.name = check.name + " (copy)" copied.name = check.name + " (copy)"
copied.desc, copied.tags = check.desc, check.tags copied.desc, copied.tags = check.desc, check.tags
copied.subject = check.subject copied.subject = check.subject
copied.subject_fail = check.subject_fail
copied.kind = check.kind copied.kind = check.kind
copied.timeout, copied.grace = check.timeout, check.grace copied.timeout, copied.grace = check.timeout, check.grace


Loading…
Cancel
Save