Exemplo n.º 1
0
 def test_getting_a_single_list(self):
     data = dict(device_id=1, designation='designation', enabled=True)
     with app.app_context():
         self.list = app.test_client()
         response = self.list.get('/list/<int:id>',
                                  data=json.dumps(data),
                                  content_type='application/json')
Exemplo n.º 2
0
 def test_delete_listShared(self):
     data = dict(list_id=1, enabled=True)
     with app.app_context():
         self.listShared = app.test_client()
         response = self.listShared.delete('/listShared/delete/<int:id>',
                                           data=json.dumps(data),
                                           content_type='application/json')
Exemplo n.º 3
0
 def test_delete_listProduct(self):
     data = dict(list_id=1, product_id=2, enabled=True)
     with app.app_context():
         self.listProduct = app.test_client()
         response = self.listProduct.delete(
             '/listProduct/<int:idProduct>/<int:idList>',
             data=json.dumps(data),
             content_type='application/json')
Exemplo n.º 4
0
 def test_update_list(self):
     data = dict(id=1, enabled=True)
     with app.app_context():
         self.list = app.test_client()
         response = self.list.put('/list/<int:id>',
                                  data=json.dumps(data),
                                  content_type='application/json')
         self.assertEqual(response.status_code, 200)
Exemplo n.º 5
0
 def test_add_listShared(self):
     data = dict(emailUser='******',
                 list_id='1',
                 permission='can view and edit',
                 group_id='1')
     with app.app_context():
         self.listShared = app.test_client()
         response = self.listShared.post('/listShared/add',
                                         data=json.dumps(data),
                                         content_type='application/json')
Exemplo n.º 6
0
    def test_add_list(self):
        data = dict(designation='test',
                    created_at='2010-04-02',
                    recurrence='1',
                    device_id='2')
        with app.app_context():
            # resp = list.get('/list')

            self.list = app.test_client()
            response = self.list.post('/list/add',
                                      data=json.dumps(data),
                                      content_type='application/json')
            self.assertEqual(response.status_code, 200)
Exemplo n.º 7
0
    def setUp(self):
        # ensure that db URI is set up correctly

        app.config['TESTING'] = True
        app.config['WTF_CSRF_ENABLED'] = False
        app.config['DEBUG'] = False
        app.config[
            'SQLALCHEMY_DATABASE_URI'] = 'mysql://*****:*****@mysql/list_ms_db' + os.path.join(
                basedir, LIST_MS_DB)
        app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
        app.config['SQLALCHEMY_COMMIT_ON_TEARDOWN'] = True
        self.app = app.test_client()

        # ensure that db create models

        db.create_all()
        db.session.add(List("FakeList", "3", "2"))
        db.session.commit()
Exemplo n.º 8
0
 def test_get_all_list(self):
     with app.app_context():
         self.list = app.test_client()
         resp = self.list.get(path='/list', content_type='application/json')
         self.assertEqual(resp.status_code, 200)