Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 54df011

Browse files
author
Tom Galloway
committed
Adding initial market profile test.
1 parent 1376346 commit 54df011

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

market/tests/test_profile.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from twisted.trial import unittest
2+
from twisted.python import log
3+
from protos import objects
4+
import os
5+
6+
from db.datastore import Database
7+
from market.profile import Profile
8+
9+
class MarketProfileTest(unittest.TestCase):
10+
def setUp(self):
11+
self.catcher = []
12+
observer = self.catcher.append
13+
log.addObserver(observer)
14+
self.addCleanup(log.removeObserver, observer)
15+
self.db = Database(filepath="test.db")
16+
self.createTestUser()
17+
18+
def createTestUser(self):
19+
u = objects.Profile()
20+
u.name = "test_name"
21+
u.location = 2
22+
u.about = "hello world"
23+
self.db.ProfileStore().set_proto(u.SerializeToString())
24+
25+
def tearDown(self):
26+
os.remove("test.db")
27+
28+
def test_MarketProfile_get_success(self):
29+
p = Profile(self.db).get()
30+
self.assertEqual('test_name', p.name)
31+
self.assertEqual(2, p.location)
32+
self.assertEqual('hello world', p.about)

0 commit comments

Comments
 (0)