Exemplo n.º 1
0
    def test_update_content_availability_true(self):

        with Using(self.db, [Item]):
            actual = dict(
                update_content_availability([
                    unparse_model_data(model_to_dict(self.item))
                ])).get("thepath")
            assert actual.get("available")
Exemplo n.º 2
0
    def test_update_content_availability_false(self):

        try:
            os.rename(self.version_path, self.version_path + ".bak")
        except OSError:
            pass

        with Using(self.db, [Item]):
            actual = dict(update_content_availability([unparse_model_data(model_to_dict(self.item))])).get("thepath")
            # Update is only generated if changed from False to True, not from False to False, so should return None.
            assert not actual

        try:
            os.rename(self.version_path + ".bak", self.version_path)
        except OSError:
            pass
Exemplo n.º 3
0
    def test_update_content_availability_false(self):

        try:
            os.rename(self.version_path, self.version_path + ".bak")
        except OSError:
            pass

        with Using(self.db, [Item]):
            actual = dict(
                update_content_availability([
                    unparse_model_data(model_to_dict(self.item))
                ])).get("thepath")
            # Update is only generated if changed from False to True, not from False to False, so should return None.
            assert not actual

        try:
            os.rename(self.version_path + ".bak", self.version_path)
        except OSError:
            pass
Exemplo n.º 4
0
    def test_update_content_availability_true(self):

        with Using(self.db, [Item]):
            actual = dict(update_content_availability([unparse_model_data(model_to_dict(self.item))])).get("thepath")
            assert actual.get("available")