def create_authors_for_deleting_tests(self): self.guid1 = u'83d5812f-ff13-46d8-8c1c-3f17a48c239f' author = Author() author.name = u'author1' author.domain = unicode(self._domain) author.author_guid = unicode(self.guid1) author.author_type = u'bad_actor' author.author_sub_type = u'crowdturfer' self.db.add_author(author) self.guid2 = u'08fffd68-52f9-45dd-a1ea-7c2a1b0206c4' author = Author() author.name = u'author2' author.domain = unicode(self._domain) author.author_guid = unicode(self.guid2) author.author_type = u'bad_actor' author.author_sub_type = None self.db.add_author(author) self.guid3 = u'a041d99d-7adc-47ad-a32b-ac24c1e43c03' author = Author() author.name = u'author3' author.domain = self._domain author.author_guid = self.guid3 author.author_type = u'bad_actor' author.author_sub_type = u'bot' self.db.add_author(author) self.guid4 = u'06bc3c1b-0350-428f-b66c-7d476f442643' author = Author() author.name = u'author4' author.domain = self._domain author.author_guid = self.guid4 author.author_type = u'good_actor' author.author_sub_type = None self.db.add_author(author) self.guid5 = u'c5c1d938-1196-4bab-9f5e-23092c7be053' author = Author() author.name = u'author5' author.domain = self._domain author.author_guid = self.guid5 author.author_type = u'bad_actor' author.author_sub_type = u'acquired' self.db.add_author(author) self.db.session.commit()
def setUp(self): self.config = getConfig() self._db = DB() self._db.setUp() self.timeline_overlap = TimelineOverlapVisualizationGenerator() author1 = Author() author1.name = 'acquired_user' author1.domain = 'Microblog' author1.author_guid = 'acquired_user' author1.author_screen_name = 'acquired_user' author1.author_full_name = 'acquired_user' author1.author_osn_id = 1 author1.created_at = datetime.datetime.now() author1.missing_data_complementor_insertion_date = datetime.datetime.now( ) author1.xml_importer_insertion_date = datetime.datetime.now() author1.author_type = 'bad_actor' author1.author_sub_type = 'acquired' self._db.add_author(author1) for i in range(1, 11): post1 = Post() post1.post_id = 'bad_post' + str(i) post1.author = 'acquired_user' post1.guid = 'bad_post' + str(i) post1.date = datetime.datetime.now() post1.domain = 'Microblog' post1.author_guid = 'acquired_user' post1.content = 'InternetTV love it' + str(i) post1.xml_importer_insertion_date = datetime.datetime.now() self._db.addPost(post1) author = Author() author.name = 'TestUser1' author.domain = 'Microblog' author.author_guid = 'TestUser1' author.author_screen_name = 'TestUser1' author.author_full_name = 'TestUser1' author.author_osn_id = 2 author.created_at = datetime.datetime.now() author.missing_data_complementor_insertion_date = datetime.datetime.now( ) author.xml_importer_insertion_date = datetime.datetime.now() self._db.add_author(author) for i in range(1, 11): post = Post() post.post_id = 'TestPost' + str(i) post.author = 'TestUser1' post.guid = 'TestPost' + str(i) post.date = datetime.datetime.now() post.domain = 'Microblog' post.author_guid = 'TestUser1' post.content = 'InternetTV love it' + str(i) post.xml_importer_insertion_date = datetime.datetime.now() self._db.addPost(post) self._db.commit()
def _convert_group_to_author(self): """ Method takes given group_id from config.ini and creates Author object for it. """ author = Author() author.name = self.get_group_name() author.author_osn_id = self._group_id author.author_guid = commons.compute_author_guid_by_osn_id( author.author_osn_id) author.domain = self._domain author.author_type = "Group" author.followers_count = self.get_group_number_of_members() author.author_sub_type = self.get_group_level_of_activity() return author
def setUp(self): self._db = DB() self._db.setUp() self.author_guid = u"author_guid" author = Author() author.author_guid = self.author_guid author.author_full_name = u'author' author.name = u'author_name' author.author_screen_name = u'author_screen_name' author.domain = u'Microblog' author.statuses_count = 10 author.friends_count = 5 author.followers_count = 6 author.favourites_count = 8 author.author_sub_type = u"bot" author.author_type = u"bad" author.created_at = u"2017-06-17 05:00:00" author.default_profile = True author.default_profile_image = True author.verified = True self._db.add_author(author) post = Post() post.author = self.author_guid post.author_guid = self.author_guid post.content = u"content" post.title = u"title" post.domain = u"domain" post.post_id = u"post_id" post.guid = post.post_id post.date = convert_str_to_unicode_datetime("2017-06-14 05:00:00") post.created_at = post.date self._db.addPost(post) self._db.session.commit() self.feature_prefix = u"AccountPropertiesFeatureGenerator_" self.account_properties_feature_generator = AccountPropertiesFeatureGenerator( self._db, **{ 'authors': [author], 'posts': { self.author_guid: [post] } }) self.account_properties_feature_generator.execute()