Example #1
0
    def test_all(self, skip, limit, expected_length):
        r = GraphRelationshipRepository('test', {})
        r._g = self.g

        actual = r.all(skip, limit)

        self.assertTrue(self.g.match.called)
        self.assertEqual(len(actual), expected_length)
        self.assertIsInstance(actual[0], dict)
Example #2
0
    def test_match(self, origin, target):
        r = GraphRelationshipRepository('test', {})
        r._g = self.g

        actual = r.match(origin, target)

        self.assertTrue(self.g.match.called)
        self.assertTrue('TEST', self.g.match.call_args[0][1])

        if origin is None:
            self.assertIsNone(self.g.match.call_args[0][0])
        else:
            self.assertIsNotNone(self.g.match.call_args[0][0])

        if target is None:
            self.assertIsNone(self.g.match.call_args[0][2])
        else:
            self.assertIsNotNone(self.g.match.call_args[0][2])