コード例 #1
0
 def test_validate_graphs_restriction_raises_error(self, mocked_filter_values):
     expected_message = "Classes in the range of predicate 'predicate1' are not in graphs ['graph3']"
     params = {
         "graphs": ["graph1", "graph2", "graph3"],
         "target": "predicate1"
     }
     try:
         suggest._validate_graph_restriction(params, None)  # None because filter_values is mocked
     except HTTPError as e:
         self.assertEqual(e.status_code, 400)
         self.assertEqual(e.log_message, expected_message)
     else:
         self.fail("a HTTPError should be raised")
コード例 #2
0
 def test_validate_graphs_restriction_raises_error_for_graphs_without_instances(self, mocked_settings, mocked_filter_values):
     expected_message = "Classes in the range of predicate 'predicate1' are in graphs without instances," + \
         " such as: ['graph_without_instances1', 'graph_without_instances2']"
     params = {
         "target": "predicate1"
     }
     try:
         suggest._validate_graph_restriction(params, None)  # None because filter_values is mocked
     except HTTPError as e:
         self.assertEqual(e.status_code, 400)
         self.assertEqual(e.log_message, expected_message)
     else:
         self.fail("a HTTPError should be raised")
コード例 #3
0
ファイル: test_suggest.py プロジェクト: bmentges/brainiak_api
 def test_validate_graphs_restriction_raises_error_for_graphs_without_instances(self, mocked_settings, mocked_filter_values):
     expected_message = "Classes in the range of predicate 'predicate1' are in graphs without instances," + \
         " such as: ['graph_without_instances1', 'graph_without_instances2']"
     params = {
         "target": "predicate1"
     }
     try:
         suggest._validate_graph_restriction(params, None)  # None because filter_values is mocked
     except HTTPError as e:
         self.assertEqual(e.status_code, 400)
         self.assertEqual(e.log_message, expected_message)
     else:
         self.fail("a HTTPError should be raised")
コード例 #4
0
ファイル: test_suggest.py プロジェクト: bmentges/brainiak_api
 def test_validate_graphs_restriction_raises_error(self, mocked_filter_values):
     expected_message = "Classes in the range of predicate 'predicate1' are not in graphs ['graph3']"
     params = {
         "graphs": ["graph1", "graph2", "graph3"],
         "target": "predicate1"
     }
     try:
         suggest._validate_graph_restriction(params, None)  # None because filter_values is mocked
     except HTTPError as e:
         self.assertEqual(e.status_code, 400)
         self.assertEqual(e.log_message, expected_message)
     else:
         self.fail("a HTTPError should be raised")
コード例 #5
0
    def test_validate_graphs_restriction_with_no_restriction_param(self, mocked_filter_values):
        expected = ["graph1", "graph2"]

        params = {}

        response = suggest._validate_graph_restriction(params, None)  # None because filter_values is mocked
        self.assertListEqual(sorted(expected), sorted(response))
コード例 #6
0
ファイル: test_suggest.py プロジェクト: bmentges/brainiak_api
    def test_validate_graphs_restriction_with_no_restriction_param(self, mocked_filter_values):
        expected = ["graph1", "graph2"]

        params = {}

        response = suggest._validate_graph_restriction(params, None)  # None because filter_values is mocked
        self.assertListEqual(sorted(expected), sorted(response))
コード例 #7
0
    def test_validate_graphs_restriction(self, mocked_filter_values):
        expected = ["graph1"]

        params = {
            "graphs": ["graph1"]
        }

        response = suggest._validate_graph_restriction(params, None)  # None because filter_values is mocked
        self.assertEqual(expected, response)
コード例 #8
0
ファイル: test_suggest.py プロジェクト: bmentges/brainiak_api
    def test_validate_graphs_restriction(self, mocked_filter_values):
        expected = ["graph1"]

        params = {
            "graphs": ["graph1"]
        }

        response = suggest._validate_graph_restriction(params, None)  # None because filter_values is mocked
        self.assertEqual(expected, response)