Beispiel #1
0
    def setUp(self):
        """Define test variables and initialize app."""
        self.app = app
        self.client = self.app.test_client
        self.db = db

        with self.app.app_context():
            self.db.session.commit()
            self.db.drop_all()
            self.db.create_all()

        items = create_starter_data()
        self.project_1 = items[0]
        self.project_2 = items[1]
        self.source_1 = items[2]
        self.source_2 = items[3]
        self.source_3 = items[4]
        self.item_1 = items[5]
        self.item_2 = items[6]
        self.item_3 = items[7]
        self.cluster_1 = items[8]

        self.new_source = {
            'title': 'New title',
            'content': 'New content',
            'project_id': self.project_2.id
        }

        self.extra_item = Item(is_note=True,
                               content='Content of Extra Item',
                               date_of_creation=datetime.utcnow())

        self.extra_item.project = self.project_1
Beispiel #2
0
    def setUp(self):
        """Define test variables and initialize app."""
        self.app = app
        self.client = self.app.test_client
        self.db = db

        with self.app.app_context():
            self.db.session.commit()
            self.db.drop_all()
            self.db.create_all()

        items = create_starter_data()
        self.project_1 = items[0]
        self.project_2 = items[1]
        self.source_1 = items[2]
        self.source_2 = items[3]
        self.source_3 = items[4]

        self.new_source = {
            'title': 'New title',
            'content': 'New content',
            'highlights': ['New highlight'],
            'notes': ['New notes'],
            'x_position': self.source_1.x_position + 100,
            'y_position': self.source_1.y_position + 100,
            'project_id': self.project_2.id
        }
Beispiel #3
0
    def setUp(self):
        """Define test variables and initialize app."""
        self.app = app
        self.client = self.app.test_client
        self.db = db

        with self.app.app_context():
            self.db.session.commit()
            self.db.drop_all()
            self.db.create_all()

        items = create_starter_data()
        self.project_1 = items[0]
        self.project_2 = items[1]
        self.source_1 = items[2]
        self.source_2 = items[3]
        self.source_3 = items[4]
Beispiel #4
0
    def setUp(self):
        """Define test variables and initialize app."""
        self.app = app
        self.client = self.app.test_client
        self.db = db

        with self.app.app_context():
            self.db.session.commit()
            self.db.drop_all()
            self.db.create_all()

        items = create_starter_data()
        self.project_1 = items[0]
        self.project_2 = items[1]
        self.source_1 = items[2]
        self.source_2 = items[3]
        self.source_3 = items[4]

        self.new_project_title = 'New Project'

        self.new_source_url = 'https://en.wikipedia.org/wiki/Test'
Beispiel #5
0
    def setUp(self):
        """Define test variables and initialize app."""
        self.app = app
        self.client = self.app.test_client
        self.db = db

        with self.app.app_context():
            self.db.session.commit()
            self.db.drop_all()
            self.db.create_all()

        items = create_starter_data()
        self.project_1 = items[0]
        self.project_2 = items[1]
        self.source_1 = items[2]
        self.source_2 = items[3]
        self.source_3 = items[4]
        self.item_1 = items[5]
        self.item_2 = items[6]
        self.item_3 = items[7]
        self.cluster = items[8]

        self.new_item_note = {
            'is_note': True,
            'content': 'New content',
            'x_position': self.item_1.x_position + 100,
            'y_position': self.item_1.y_position + 100,
            'parent_project': self.project_2.id
        }

        self.new_item_highlight = {
            'is_note': False,
            'content': '"New highlight"',
            'x_position': self.item_1.x_position + 50,
            'y_position': self.item_1.y_position + 50,
            'parent_project': self.project_2.id
        }

        self.new_item_in_cluster = {
            'url': self.source_1.url,
            'is_note': False,
            'content': 'Item in cluster',
            'x_position': self.item_1.x_position + 50,
            'y_position': self.item_1.y_position + 50,
            'parent_cluster': self.cluster.id
        }

        self.new_item_source_1 = {
            'url': "https://en.wikipedia.org/wiki/Horse",
            'is_note': False,
            'content': 'Horse Source',
            'x_position': self.item_1.x_position + 50,
            'y_position': self.item_1.y_position + 50,
            'parent_cluster': self.cluster.id
        }

        self.new_item_source_2 = {
            'url': "https://www.messenger.com/",
            'is_note': False,
            'content': 'FB Messenger',
            'x_position': self.item_1.x_position + 50,
            'y_position': self.item_1.y_position + 50,
            'parent_cluster': self.cluster.id
        }
Beispiel #6
0
    def setUp(self):
        """Define test variables and initialize app."""
        self.app = app
        self.client = self.app.test_client
        self.db = db

        with self.app.app_context():
            self.db.session.commit()
            self.db.drop_all()
            self.db.create_all()

        items = create_starter_data()
        self.project_1 = items[0]
        self.project_2 = items[1]
        self.source_1 = items[2]
        self.source_2 = items[3]
        self.source_3 = items[4]
        self.item_1 = items[5]
        self.item_2 = items[6]
        self.item_3 = items[7]

        self.new_project_title = 'New Project'

        self.new_source_url = 'https://en.wikipedia.org/wiki/Test'

        self.new_item_only_note = {
            'content': 'This is a new pure note item',
            'is_note': True,
            'parent_project': self.project_1.id
        }

        self.new_item_only_highlight = {
            'content': '"This is a new highlight item"',
            'is_note': False,
            'parent_project': self.project_1.id
        }

        self.new_item_note_url_first = {
            'url': 'https://en.wikipedia.org/wiki/WandaVision',
            'content': 'This is a first note',
            'parent_project': self.project_1.id,
            'is_note': True
        }

        self.new_item_note_url = {
            'url': 'https://en.wikipedia.org/wiki/WandaVision',
            'content': 'This is a new note url item',
            'parent_project': self.project_1.id,
            'is_note': True
        }

        self.new_item_note_new_url = {
            'url': 'https://en.wikipedia.org/wiki/Aunty_Donna',
            'content': 'This is a new note and a new url item',
            'parent_project': self.project_1.id,
            'is_note': True
        }

        # Used to test that a new item can be made with the same url
        self.new_item_url_first = {
            'url': 'https://en.wikipedia.org/wiki/Odunlade_Adekola',
            'content': '"This is a new highlight url item first"',
            'parent_project': self.project_2.id,
            'is_note': False
        }

        self.new_item_highlight_url = {
            'url': 'https://en.wikipedia.org/wiki/Odunlade_Adekola',
            'content': '"This is a new highlight url item"',
            'parent_project': self.project_2.id,
            'is_note': False
        }

        self.new_item_highlight_new_url = {
            'url': 'https://en.wikipedia.org/'
            'wiki/Michael_Jackson%27s_Thriller',
            'content': '"This is a highlight item with a new url"',
            'parent_project': self.project_2.id,
            'is_note': True
        }

        self.new_item_url = {
            'url': 'https://en.wikipedia.org/wiki/George_Michael',
            'content': None,
            'parent_project': self.project_1.id,
            'is_note': False
        }

        self.new_item_repeat_url = {
            'url': self.source_1.url,
            'content': None,
            'parent_project': self.project_1.id,
            'is_note': False
        }

        self.new_item_same_note = {
            'url': None,
            'content': self.item_1.content,
            'parent_project': self.project_1.id,
            'is_note': True
        }