removed cryptoshim, work on peers, added test
This commit is contained in:
parent
52fb4b139b
commit
6c61626e0f
10
core.py
10
core.py
@ -33,9 +33,15 @@ class Core:
|
|||||||
key = gpg.gen_key(input_data)
|
key = gpg.gen_key(input_data)
|
||||||
return
|
return
|
||||||
|
|
||||||
def addPeer(self, id, name=''):
|
def addPeer(self, peerID, name=''):
|
||||||
# This function simply adds a peer to the DB
|
# This function simply adds a peer to the DB
|
||||||
return
|
conn = sqlite3.connect(self.peerDB)
|
||||||
|
c = conn.cursor()
|
||||||
|
t = (peerID, name)
|
||||||
|
c.execute('Insert into users (id, name) values(?, ?);', t)
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
|
return True
|
||||||
|
|
||||||
def createPeerDB(self):
|
def createPeerDB(self):
|
||||||
# generate the peer database
|
# generate the peer database
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
'''
|
|
||||||
Onionr - P2P Microblogging Platform & Social network. Run with 'help' for usage.
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
'''
|
|
||||||
|
|
@ -50,7 +50,7 @@ class Onionr:
|
|||||||
if not os.path.exists('data/'):
|
if not os.path.exists('data/'):
|
||||||
os.mkdir('data/')
|
os.mkdir('data/')
|
||||||
|
|
||||||
if os.path.exists('data/peers.db'):
|
if not os.path.exists('data/peers.db'):
|
||||||
onionrCore.createPeerDB()
|
onionrCore.createPeerDB()
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
12
tests.py
12
tests.py
@ -32,7 +32,7 @@ class OnionrTests(unittest.TestCase):
|
|||||||
self.assertTrue(False)
|
self.assertTrue(False)
|
||||||
else:
|
else:
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
def testPeerDBCreation(self):
|
def testPeer_a_DBCreation(self):
|
||||||
print('--------------------------')
|
print('--------------------------')
|
||||||
print('Running peer db creation test')
|
print('Running peer db creation test')
|
||||||
if os.path.exists('data/peers.db'):
|
if os.path.exists('data/peers.db'):
|
||||||
@ -44,6 +44,16 @@ class OnionrTests(unittest.TestCase):
|
|||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
else:
|
else:
|
||||||
self.assertTrue(False)
|
self.assertTrue(False)
|
||||||
|
def testPeer_b_addPeerToDB(self):
|
||||||
|
print('--------------------------')
|
||||||
|
print('Running peer db insertion test')
|
||||||
|
import core
|
||||||
|
myCore = core.Core()
|
||||||
|
myCore.createPeerDB()
|
||||||
|
if myCore.addPeer('test'):
|
||||||
|
self.asserTrue(True)
|
||||||
|
else:
|
||||||
|
self.assertTrue(False)
|
||||||
def testData_b_Encrypt(self):
|
def testData_b_Encrypt(self):
|
||||||
self.assertTrue(True)
|
self.assertTrue(True)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user