Beispiel #1
0
 def setUp(self):
     blogs.init_app(self.app)
     client_modules.init_app(self.app)
     # set default ordering status
     self.default_ordering = 'newest_first'
     self.blog_instance = Blog('5aa60e5e4d003d133fe75b61')
Beispiel #2
0
 def setUp(self):
     blogs.init_app(self.app)
     client_modules.init_app(self.app)
     self.blog_instance = Blog('5aa60e5e4d003d133fe75b61')
Beispiel #3
0
 def setUp(self):
     init_app(self.app)
Beispiel #4
0
    def setUp(self):
        if not foo.setup_call:
            test_config = {
                'LIVEBLOG_DEBUG': True,
                'EMBED_PROTOCOL': 'http://',
                'CORS_ENABLED': False,
                'DEBUG': False,
            }
            self.app.config.update(test_config)
            foo.setup_called()
            blogs.init_app(self.app)
            items_app.init_app(self.app)
            users_app.init_app(self.app)
            client_modules.init_app(self.app)
            self.app.register_blueprint(blog_posts_blueprint)
            self.client = self.app.test_client()
            self.app.cache = Cache(self.app, config={'CACHE_TYPE': 'simple'})

        self.client_item_service = get_resource_service('client_items')
        self.client_comment_service = get_resource_service('client_comments')

        self.item_docs = [{
            "commenter": "test commenter",
            "text": "test comment",
            "client_blog": ObjectId("5ab90249fd16ad1752b39b74"),
            "item_type": "comment",
            "_updated": datetime.datetime(2018, 4, 11, 6, 43, 47),
            "_created": datetime.datetime(2018, 4, 11, 6, 43, 47),
            "type": "text",
            "pubstatus": "usable",
            "flags": {
                "marked_for_not_publication": False,
                "marked_for_legal": False,
                "marked_archived_only": False,
                "marked_for_sms": False
            },
            "format": "HTML",
            "particular_type": "item",
            "group_type": "default",
            "meta": {},
            "_current_version": 1
        }]

        res = self.app.data.insert('client_items', self.item_docs)

        self.comment_docs = [{
            "post_status":
            "comment",
            "client_blog":
            ObjectId("5ab90249fd16ad1752b39b74"),
            "groups": [{
                "id": "root",
                "refs": [{
                    "idRef": "main"
                }],
                "role": "grpRole:NEP"
            }, {
                "id": "main",
                "refs": [{
                    "residRef": res[0]
                }],
                "role": "grpRole:Main"
            }],
            "_updated":
            datetime.datetime(2018, 4, 11, 6, 44, 1),
            "_created":
            datetime.datetime(2018, 4, 11, 6, 44, 1),
            "type":
            "text",
            "pubstatus":
            "usable",
            "flags": {
                "marked_for_not_publication": False,
                "marked_for_legal": False,
                "marked_archived_only": False,
                "marked_for_sms": False
            },
            "format":
            "HTML",
            "particular_type":
            "post",
            "lb_highlight":
            False,
            "sticky":
            False,
            "deleted":
            False,
            "order":
            0.0,
            "_current_version":
            1
        }]

        self.blog_post_service = get_resource_service('client_blog_posts')
        self.blogs_service = get_resource_service('blogs')
        self.client_blog_service = get_resource_service('client_blogs')
        self.users_service = get_resource_service('users')

        self.user_list = [{
            '_created': '2018-03-20T00:00:00+00:00',
            '_updated': '2018-03-20T10:00:00+00:00',
            'username': '******',
            'display_name': 'Edwin the admin',
            'first_name': 'Edwin',
            'is_active': True,
            'is_enabled': True,
            'last_name': 'the admin',
            'sign_off': 'off',
            'byline': 'by',
            'email': '*****@*****.**',
        }]

        self.user_ids = self.app.data.insert('users', self.user_list)

        self.blogs_list = [{
            "_created": "2018-03-27T12:04:58+00:00",
            "_etag": "b962afec2413ddf43fcf0273a1a422a2fec1e34d",
            "_type": "blogs",
            "_updated": "2018-04-03T05:54:32+00:00",
            "blog_preferences": {
                "language": "en",
                "theme": "classic"
            },
            "blog_status": "open",
            "category": "",
            "description": "title: end to end Five",
            "firstcreated": "2018-03-27T12:04:58+00:00",
            "last_created_post": {
                "_id":
                "urn:newsml:localhost:2018-04-03T11:12:43.187311:ad5e39b1-2fb2-4676-bd2f-425dca184765",
                "_updated": "2018-04-03T05:42:43+00:00"
            },
            "last_updated_post": {
                "_id":
                "urn:newsml:localhost:2018-04-03T11:12:43.187311:ad5e39b1-2fb2-4676-bd2f-425dca184765",
                "_updated": "2018-04-03T05:43:12+00:00"
            },
            "market_enabled": False,
            "members": [],
            "original_creator": self.user_ids[0],
            "picture":
            "urn:newsml:localhost:2018-03-27T17:34:58.093848:973b4459-5511-45fc-9bfe-4855159ea917",
            "picture_renditions": {
                "baseImage": {
                    "height": 1075,
                    "href":
                    "http://*****:*****@other.com",
                "sign_off": "abc",
                "username": "******"
            },
            "pubstatus":
            "usable",
            "schedule_settings": {
                "time_zone": None,
                "utc_embargo": None
            },
            "sign_off":
            "abc",
            "source":
            "Liveblog",
            "state":
            "draft",
            "sticky":
            False,
            "type":
            "composite",
            "unique_id":
            235,
            "unique_name":
            "#235",
            "urgency":
            3,
            "version_creator":
            self.user_ids[0],
            "versioncreated":
            "2018-04-03T05:42:43+00:00"
        }]

        self.blog_post_ids = self.app.data.insert('client_blog_posts',
                                                  self.blog_posts)
Beispiel #5
0
    def setUp(self):
        blog_app.init_app(self.app)
        advert_app.init_app(self.app)

        self.blog_with_output = {
            'title': 'Test blog',
            'description': '',
            'members': [],
            'posts_order_sequence': 0.0,
            'blog_status': 'open',
            'syndication_enabled': False,
            'market_enabled': False,
            'category': '',
            'total_posts': 0,
            'original_creator': '5b1a6935fd16ad1ce83822da',
            'blog_preferences': {
                'language': 'en',
                'theme': 'default'
            },
            'theme_settings': {
                'outputChannel': True,
                'outputChannelName': 'Test channel',
                'outputChannelTheme': 'amp'
            },
            '_etag': '853b12bef642b42b67f8e2273b19f4cba5c88ac3',
            '_id': '5b35df76fd16ad23840abb70',
            '_links': {
                'self': {
                    'title': 'Blog',
                    'href': 'blogs/5b35df76fd16ad23840abb70'
                }
            },
            '_status': 'OK'
        }

        self.blog_without_output = {
            'title': 'Test blog',
            'description': '',
            'members': [],
            'posts_order_sequence': 0.0,
            'blog_status': 'open',
            'syndication_enabled': False,
            'market_enabled': False,
            'category': '',
            'total_posts': 0,
            'original_creator': '5b1a6935fd16ad1ce83822da',
            'blog_preferences': {
                'language': 'en',
                'theme': 'default'
            },
            'theme_settings': {
                'outputChannel': False,
                'outputChannelName': 'Test channel',
                'outputChannelTheme': 'amp'
            },
            '_etag': '853b12bef642b42b67f8e2273b19f4cba5c88ac3',
            '_id': '5b35df76fd16ad23840abb70',
            '_links': {
                'self': {
                    'title': 'Blog',
                    'href': 'blogs/5b35df76fd16ad23840abb70'
                }
            },
            '_status': 'OK'
        }