コード例 #1
0
ファイル: rest_tests.py プロジェクト: reydelamirienda/bulbs
 def setUp(self):
     #self.resource = Resource(config.DATABASE_URL)
     config = Config(root_uri=None)
     self.request = RexsterRequest(config)
コード例 #2
0
ファイル: rest_tests.py プロジェクト: reydelamirienda/bulbs
 def setUp(self):
     #self.resource = Resource(config.DATABASE_URL)
     config = Config(root_uri=None)
     self.request = RexsterRequest(config)
コード例 #3
0
ファイル: rest_tests.py プロジェクト: reydelamirienda/bulbs
class RestTestCase(unittest.TestCase):
    def setUp(self):
        #self.resource = Resource(config.DATABASE_URL)
        config = Config(root_uri=None)
        self.request = RexsterRequest(config)

    def test_init(self):
        config = Config('http://*****:*****@jamesthornton.com"

        path = build_path("vertices")
        params = dict(name=name_in, email=email_in)
        resp = self.request.post(path, params)

        assert resp.results._type == 'vertex'
        assert name_in == resp.results.get('name')
        assert email_in == resp.results.get('email')

        # use the results of this function for get and delete tests
        return resp

    def test_get(self):
        resp1 = self.test_post()
        oid1 = resp1.results.get('_id')
        element_type1 = resp1.results.get('_type')
        name1 = resp1.results.get('name')
        email1 = resp1.results.get('email')

        path = build_path("vertices", oid1)
        params = dict(name=name1, email=email1)
        resp2 = self.request.get(path, params)

        assert oid1 == resp2.results.get('_id')
        assert element_type1 == resp2.results.get('_type')
        assert name1 == resp2.results.get('name')
        assert email1 == resp2.results.get('email')

    def test_delete(self):

        resp1 = self.test_post()
        oid1 = resp1.results.get('_id')
        name1 = resp1.results.get('name')
        email1 = resp1.results.get('email')

        # make sure it's there
        #assert type(oid1) == int

        # delete it
        path = build_path("vertices", oid1)
        params = dict(name=name1, email=email1)
        resp2 = self.request.delete(path, params)

        # verify it's gone
        #assert "SNAPSHOT" in resp2.rexster_version
        #assert type(resp2.get('query_time')) == float
        assert resp2.results == None
コード例 #4
0
ファイル: rest_tests.py プロジェクト: reydelamirienda/bulbs
class RestTestCase(unittest.TestCase):
    
    def setUp(self):
        #self.resource = Resource(config.DATABASE_URL)
        config = Config(root_uri=None)
        self.request = RexsterRequest(config)

    def test_init(self):
        config = Config('http://*****:*****@jamesthornton.com"

        path = build_path("vertices")
        params = dict(name=name_in, email=email_in)
        resp = self.request.post(path,params)
                
        assert resp.results._type == 'vertex'
        assert name_in == resp.results.get('name') 
        assert email_in == resp.results.get('email')

        # use the results of this function for get and delete tests 
        return resp
        
    def test_get(self):
        resp1 = self.test_post()
        oid1 = resp1.results.get('_id')
        element_type1 = resp1.results.get('_type')
        name1 = resp1.results.get('name')
        email1 = resp1.results.get('email')

        path = build_path("vertices",oid1)
        params = dict(name=name1, email=email1)
        resp2 = self.request.get(path,params)

        assert oid1 == resp2.results.get('_id')
        assert element_type1 == resp2.results.get('_type')
        assert name1 == resp2.results.get('name')
        assert email1 == resp2.results.get('email')

    def test_delete(self):

        resp1 = self.test_post()
        oid1 = resp1.results.get('_id')
        name1 = resp1.results.get('name')
        email1 = resp1.results.get('email')

        # make sure it's there
        #assert type(oid1) == int

        # delete it
        path = build_path("vertices",oid1)
        params = dict(name=name1, email=email1)
        resp2 = self.request.delete(path,params)

        # verify it's gone
        #assert "SNAPSHOT" in resp2.rexster_version
        #assert type(resp2.get('query_time')) == float
        assert resp2.results == None