本文整理匯總了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):
#.........這裏部分代碼省略.........