本文整理汇总了Python中error.models.Error.save方法的典型用法代码示例。如果您正苦于以下问题:Python Error.save方法的具体用法?Python Error.save怎么用?Python Error.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类error.models.Error
的用法示例。
在下文中一共展示了Error.save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testCount
# 需要导入模块: from error.models import Error [as 别名]
# 或者: from error.models.Error import save [as 别名]
def testCount(self):
for x in range(0, 1110):
Error().save(dont_send_signals=True)
assert count() == 1110
for x in range(0, 5):
err = Error(dont_send_signals=True)
err.priority = 4
err.save()
assert count(["priority = ", 4]) == 5
assert count(["priority = ", None]) == 1110
assert count() == 1115
示例2: TestJobTypesSystemFailuresView
# 需要导入模块: from error.models import Error [as 别名]
# 或者: from error.models.Error import save [as 别名]
class TestJobTypesSystemFailuresView(TestCase):
def setUp(self):
django.setup()
self.error = Error(name="Test Error", description="test")
self.error.save()
self.job = job_test_utils.create_job(status="FAILED", error=self.error)
def test_successful(self):
"""Tests successfully calling the system failures view."""
url = "/job-types/system-failures/"
response = self.client.generic("GET", url)
result = json.loads(response.content)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(len(result["results"]), 1)
self.assertEqual(result["results"][0]["job_type"]["name"], self.job.job_type.name)
self.assertEqual(result["results"][0]["error"]["name"], self.error.name)
self.assertEqual(result["results"][0]["count"], 1)
示例3: ErrorTests
# 需要导入模块: from error.models import Error [as 别名]
# 或者: from error.models.Error import save [as 别名]
class ErrorTests(TestCase):
# test the view for writing errors
def setUp(self):
for issue in Issue.all(): issue.delete()
for log in Log.all(): log.delete()
for comment in Comment.all(): comment.delete()
for group in Group.all(): group.delete()
for error in Error.all(): error.delete()
for project in Project.all(): project.delete()
def testLogAdded(self):
issue = Issue()
issue.description = "This is a test"
issue.save()
assert issue.log_set[0]
def _setup(self):
self.project = Project(name="testing")
self.project.save()
self.url = ProjectURL(url="http://test.areciboapp.com")
self.url.project = self.project
self.url.save()
self.url = ProjectURL(url="http://www.areciboapp.com")
self.url.project = self.project
self.url.save()
self.error = Error()
for k, v in break_url("http://test.areciboapp.com/an/other").items():
setattr(self.error, k, v)
self.error.save()
def _issue(self):
self.issue = Issue()
self.issue.description = "This is a test"
self.issue.save()
def testIssueGroup(self):
self._setup()
self._issue()
group = Group.all()[0]
self.issue.add_group(group)
assert group == self.issue.issuegroup_set[0].group
assert self.issue.issuegroup_set.count() == 1
assert self.issue == IssueGroup.all().filter("issue = ", self.issue)[0].issue
def testIssueURL(self):
self._setup()
self.issue = Issue()
self.issue.description = "This is a test"
self.issue.project = self.project
self.issue.save()
assert self.issue.issueprojecturl_set.count() == 2
assert self.issue.issueprojecturl_set[0].status == "not_fixed"
def testIssueURLFlexibility(self):
self._setup()
self._issue()
assert self.issue == issue_by_number(self.issue.number)
assert self.issue == issue_by_number(self.issue.number)
def testIssueChanged(self):
self.signal_fired = False
def signal_fired(instance, old, **kw):
self.signal_fired = True
signals.issue_changed.connect(signal_fired, dispatch_uid="issue_changed")
self._issue()
self.issue.status = "rejected"
self.issue.save()
assert self.signal_fired
def testIssuePriorityChanged(self):
self.signal_fired = False
def signal_fired(instance, old, new, **kw):
self.signal_fired = True
assert old in (None, 1)
assert new in (1, 2)
signals.issue_priority_changed.connect(signal_fired, dispatch_uid="issue_priority_changed")
self._issue()
self.issue.priority = 1
self.issue.save()
assert self.signal_fired
self.signal_fired = False
self.issue.priority = 2
self.issue.save()
assert self.signal_fired
def testIssueStatusChanged(self):
#.........这里部分代码省略.........