Ejemplo n.º 1
0
	def test_ignore_last_closed(self):
		cursor = []
		self._addClosedDoc(cursor, "ignore close")
		self._addOpenedDoc(cursor, "ignore_open")
		self._addClosedRow(cursor)

		sessions = MendeleyDB._build_sessions(cursor)
		self.assertEqual(0, len(sessions))

		self._addClosedDoc(cursor, "close")
		self._addOpenedDoc(cursor, "open")

		sessions = MendeleyDB._build_sessions(cursor)
		self.assertEqual(1, len(sessions))
Ejemplo n.º 2
0
    def test_ignore_last_closed(self):
        cursor = []
        self._addClosedDoc(cursor, "ignore close")
        self._addOpenedDoc(cursor, "ignore_open")
        self._addClosedRow(cursor)

        sessions = MendeleyDB._build_sessions(cursor)
        self.assertEqual(0, len(sessions))

        self._addClosedDoc(cursor, "close")
        self._addOpenedDoc(cursor, "open")

        sessions = MendeleyDB._build_sessions(cursor)
        self.assertEqual(1, len(sessions))
Ejemplo n.º 3
0
 def test_local(self):
     mendeley_database = find_mendeley_db_file()
     with MendeleyDB(mendeley_database) as mendeley_db:
         sessions = mendeley_db.get_last_opened_sessions()
         self.assertLess(0, len(sessions))
         for session in sessions:
             print(session)
             for doc in session.documents:
                 print(doc)
Ejemplo n.º 4
0
	def test_add_twice(self):
		cursor = []
		self._addClosedRow(cursor)
		self._addOpenedDoc(cursor, "open")
		self._addOpenedDoc(cursor, "open")
		self._addClosedRow(cursor)
		self._addClosedRow(cursor)

		sessions = MendeleyDB._build_sessions(cursor)
		self.assertEqual(1, len(sessions))
		self.assertEqual(1, len(sessions[0].documents))
Ejemplo n.º 5
0
    def test_add_twice(self):
        cursor = []
        self._addClosedRow(cursor)
        self._addOpenedDoc(cursor, "open")
        self._addOpenedDoc(cursor, "open")
        self._addClosedRow(cursor)
        self._addClosedRow(cursor)

        sessions = MendeleyDB._build_sessions(cursor)
        self.assertEqual(1, len(sessions))
        self.assertEqual(1, len(sessions[0].documents))
Ejemplo n.º 6
0
	def test_ignore_closed_doc(self):
		cursor = []
		self._addClosedRow(cursor)
		self._addClosedDoc(cursor, "closed_uuid")
		self._addOpenedDoc(cursor, "closed_uuid")
		self._addOpenedDoc(cursor, "uuid")

		sessions = MendeleyDB._build_sessions(cursor)

		self.assertEqual(1, len(sessions))
		self.assertEqual(1, sessions[0].size)
		self.assertEqual("uuid", list(sessions[0].documents)[0].uuid)
Ejemplo n.º 7
0
    def test_ignore_closed_doc(self):
        cursor = []
        self._addClosedRow(cursor)
        self._addClosedDoc(cursor, "closed_uuid")
        self._addOpenedDoc(cursor, "closed_uuid")
        self._addOpenedDoc(cursor, "uuid")

        sessions = MendeleyDB._build_sessions(cursor)

        self.assertEqual(1, len(sessions))
        self.assertEqual(1, sessions[0].size)
        self.assertEqual("uuid", list(sessions[0].documents)[0].uuid)
Ejemplo n.º 8
0
	def test_multi_session(self):
		cursor = []
		self._addClosedRow(cursor)
		self._addClosedDoc(cursor, "closed_uuid")
		self._addOpenedDoc(cursor, "closed_uuid")
		self._addOpenedDoc(cursor, "uuid")
		self._addClosedRow(cursor)
		self._addOpenedDoc(cursor, "closed_uuid")
		self._addOpenedDoc(cursor, "uuid")
		self._addOpenedDoc(cursor, "another_uuid")

		sessions = MendeleyDB._build_sessions(cursor)

		self.assertEqual(2, len(sessions))
		self.assertEqual(1, sessions[0].size)
		self.assertEqual(3, sessions[1].size)
		self.assertEqual("uuid", list(sessions[0].documents)[0].uuid)
Ejemplo n.º 9
0
    def test_multi_session(self):
        cursor = []
        self._addClosedRow(cursor)
        self._addClosedDoc(cursor, "closed_uuid")
        self._addOpenedDoc(cursor, "closed_uuid")
        self._addOpenedDoc(cursor, "uuid")
        self._addClosedRow(cursor)
        self._addOpenedDoc(cursor, "closed_uuid")
        self._addOpenedDoc(cursor, "uuid")
        self._addOpenedDoc(cursor, "another_uuid")

        sessions = MendeleyDB._build_sessions(cursor)

        self.assertEqual(2, len(sessions))
        self.assertEqual(1, sessions[0].size)
        self.assertEqual(3, sessions[1].size)
        self.assertEqual("uuid", list(sessions[0].documents)[0].uuid)