Esempio n. 1
0
    def test_children(self):
        # Data with no id should fail.
        data = Data(id=None, resolwe=MagicMock())
        with self.assertRaisesRegex(ValueError, 'Instance must be saved *'):
            data.children  # pylint: disable=pointless-statement

        # Core functionality should be checked with e2e tests.

        # Check that cache is cleared at update.
        data = Data(id=42, resolwe=MagicMock())
        data._children = 'foo'
        data.update()
        self.assertEqual(data._children, None)
Esempio n. 2
0
    def test_children(self):
        # Data with no id should fail.
        data = Data(id=None, resolwe=MagicMock())
        with self.assertRaisesRegex(ValueError, 'Instance must be saved *'):
            data.children  # pylint: disable=pointless-statement

        # Core functionality should be checked with e2e tests.

        # Check that cache is cleared at update.
        data = Data(id=42, resolwe=MagicMock())
        data._children = 'foo'
        data.update()
        self.assertEqual(data._children, None)
Esempio n. 3
0
    def test_children(self):
        # Data with no id should fail.
        data = Data(id=None, resolwe=MagicMock())
        with self.assertRaisesRegex(ValueError, "Instance must be saved *"):
            data.children

        # Core functionality should be checked with e2e tests.

        # Check that cache is cleared at update.
        data = Data(id=42, resolwe=MagicMock())
        data._children = "foo"
        data.update()
        self.assertEqual(data._children, None)