Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_metavalue_startswith_filter_with_invalid_param(self):
queryset = YaraRuleFilter({'metavalue_startswith': self.failure_keyword}, queryset=self.queryset).qs
self.assertEqual(0, queryset.count())
def test_tagged_filter_as_true(self):
queryset = YaraRuleFilter({'tagged': 'true'}, queryset=self.queryset).qs
self.assertEqual(2, queryset.count())
def test_all_dependencies_filter_with_single_dependency(self):
queryset = YaraRuleFilter({'all_dependencies': 'TestRule1'}, queryset=self.queryset).qs
self.assertEqual(1, queryset.count())
def test_metavalue_endswith_filter_with_valid_param(self):
queryset = YaraRuleFilter({'metavalue_endswith': 'Rule'}, queryset=self.queryset).qs
self.assertEqual(1, queryset.count())
def test_category_filter_with_multiple_categories(self):
queryset = YaraRuleFilter({'category': 'Test Rules, Experimental Rules'}, queryset=self.queryset).qs
self.assertEqual(3, queryset.count())
def test_metakey_contains_filter_with_invalid_param(self):
queryset = YaraRuleFilter({'metakey_contains': self.failure_keyword}, queryset=self.queryset).qs
self.assertEqual(0, queryset.count())
def test_tagged_filter_as_false(self):
queryset = YaraRuleFilter({'tagged': 'false'}, queryset=self.queryset).qs
self.assertEqual(1, queryset.count())
def test_all_metakeys_filter_with_multiple_metakeys(self):
queryset = YaraRuleFilter({'all_metakeys': 'author, description'}, queryset=self.queryset).qs
self.assertEqual(1, queryset.count())
def test_all_imports_filter_with_invalid_import(self):
queryset = YaraRuleFilter({'all_imports': self.failure_keyword}, queryset=self.queryset).qs
self.assertEqual(0, queryset.count())
def test_submitter_filter_with_single_username_param(self):
queryset = YaraRuleFilter({'submitter': '{}'.format(self.user.username)}, queryset=self.queryset).qs
self.assertEqual(3, queryset.count())