def METHOD_NAME(self):
    build = self.project.builds.create(
        datetime=self.date,
        version=self.date.strftime("%Y%m%d"),
    )
    test_run = build.test_runs.create(environment=self.env1)
    # create failed test
    foo_metadata, _ = SuiteMetadata.objects.get_or_create(suite=self.suite1.slug, name='test_foo', kind='test')
    test = test_run.tests.create(build=test_run.build, environment=test_run.environment, suite=self.suite1, metadata=foo_metadata, result=False)
    known_issue = KnownIssue.objects.create(
        title="foo",
        test_name=test.full_name
    )
    known_issue.save()
    known_issue.environments.add(test_run.environment)
    known_issue.active = False
    known_issue.save()
    self.assertEqual(0, len(KnownIssue.active_by_environment(self.env1)))