コード例 #1
0
    def test_store_creation(self):
        store = StoreModel('test_store')

        self.assertEqual(store.name, 'test_store')
コード例 #2
0
ファイル: store.py プロジェクト: Mehdi-orang/stores_rest-api
 def delete(self, name):
     if StoreModel.find_store_by_name(name):
         store = StoreModel(name)
         store.delete_from_db()
         return {'success': 'store deleted successfully'}
     return {'error': 'store not found'}, 404
コード例 #3
0
    def test_create_store_items_empty(self):
        store = StoreModel('test')

        self.assertListEqual(store.items.all(), [])
コード例 #4
0
    def test_store_json(self):
        store = StoreModel('test store')
        expected = {'name': 'test store', 'items': []}

        self.assertDictEqual(store.json(), expected)
コード例 #5
0
    def test_store_json_empty_items(self):
        with self.app_context():
            store = StoreModel('test-store')
            expected = {'name': 'test-store', 'items': []}

            self.assertDictEqual(store.json(), expected)
コード例 #6
0
 def test_store_json(self):
     store = StoreModel("test")
     expected = {"name": "test", "items": []}
     self.assertDictEqual(store.json(), expected)
コード例 #7
0
    def test_create_store(self):
        store = StoreModel('test')

        self.assertEqual(
            store.name, 'test',
            "The name of the store after creation does not equal 'test'")
コード例 #8
0
    def test_store_json(self):
        store = StoreModel("test")
        expected = {"id": None, 'name': "test", 'items': []}

        self.assertEqual(store.json(), expected)
コード例 #9
0
 def test_store_model_crud(self):
     self.store_model = StoreModel(6, 'TestProduct', 19.99)
     self.assertIsNone(self.store_model.find_by_product('TestProduct'))
     self.assertIsNotNone(self.store_model.find_by_product('car_1'))
コード例 #10
0
 def test_create_store(self):
     store = StoreModel("test")
     self.assertEqual(
         store.name, "test",
         "The store name store creation does not equal the constructor argument."
     )
コード例 #11
0
    def test_create_store(self):
        store = StoreModel('test')

        self.assertEqual(store.name,
                         'test',
                         "Name of store is not equal to constructors argument")
コード例 #12
0
ファイル: store.py プロジェクト: NIKUNJGOYAL/Rest-Api
 def post(self,name):
     if StoreModel.find_by_name(name):
         return {'message':"a store with name '{}' already there".format(name)},400
     store=StoreModel(name)
     store.save_to_db()
コード例 #13
0
ファイル: store.py プロジェクト: HudiDev/First-Flask-REST-API
 def post(self, name):
     if StoreModel.find_by_name(name):
         return {'message': 'There is a store like this in the DB'}, 400
     new_store = StoreModel(name)
     new_store.save_to_db()
     return new_store.json()
コード例 #14
0
ファイル: test_store.py プロジェクト: rimrim/flaskSkeleton
 def test_create_store_item_empty(self):
     store = StoreModel('test')
     self.assertListEqual(store.items.all(), [],
                          "items is not empty when creating store")
コード例 #15
0
    def test_create_store(self):
        store = StoreModel("Test Store")

        self.assertEqual(store.name, "Test Store")
コード例 #16
0
ファイル: test_store.py プロジェクト: Ozrlz/Python-Testing
 def setUp(self):
     self.store = StoreModel('Test name')
     return super(TestStore, self).setUp()
コード例 #17
0
ファイル: test_store.py プロジェクト: Narachii/flask-API-test
 def test_create_duplicate_store(self):
     with self.app() as client:
         with self.app_context():
             StoreModel('test').save_to_db()
             resp = client.post('/store/test')
             self.assertEqual(resp.status_code, 400)
コード例 #18
0
    def test_store_json(self):  # this is checking the database returns entry
        store = StoreModel('test')
        expected = {'id': None, 'name': 'test', 'items': []}

        self.assertDictEqual(store.json(), expected)
コード例 #19
0
 def post(self, name):
     if StoreModel.find_by_name(name):
         return {'message': 'a store with name already exists'}
     store = StoreModel(name)
     store.save_to_db()
     return store.json()
コード例 #20
0
    def test_create_store(self):
        store = StoreModel('test')

        self.assertEqual(store.name, 'test',
                         "The name of the store after creation does not equal the constructor argument.")
コード例 #21
0
    def test_create_store(self):
        store = StoreModel('Test')

        self.assertEqual(store.name, 'Test')
コード例 #22
0
    def test_json(self):
        store = StoreModel("Test Store")
        expected = {"id": None, "name": "Test Store", "items": []}

        self.assertEqual(expected, store.json())
コード例 #23
0
    def test_create_store_with_no_item(self):
        store = StoreModel('test store')

        self.assertListEqual(store.items.all(), [])
コード例 #24
0
 def post(self, name):
     if StoreModel.find_by_name(name):
         return {"message": "store already exits"}, 400
     store = StoreModel(name)
     store.save_to_db()
     return store.json()
コード例 #25
0
ファイル: store.py プロジェクト: Mehdi-orang/stores_rest-api
 def post(self, name):
     if StoreModel.find_store_by_name(name):
         return {'error': "A store with the name '{}' is already exists".format(name)}, 400
     store = StoreModel(name)
     store.save_to_db()
     return store.json(), 201
コード例 #26
0
ファイル: test_store.py プロジェクト: thiagofgf/ast-tests
    def test_constructor(self):
        s = StoreModel('Test')

        self.assertEqual(s.name, 'Test')
コード例 #27
0
    def test_store_json_empty_item_list(self):
        store = StoreModel('test')
        expected = {'name': 'test', 'items': []}

        self.assertDictEqual(store.json(), expected)
コード例 #28
0
 def test_create_store(self):
     store = StoreModel('Test')
     self.assertEqual(
         store.name, 'Test',
         "The name of the store doesn't match the constructor argument.")
コード例 #29
0
ファイル: test_store.py プロジェクト: odwanodada/RESTAPIPART2
 def test_create_store(self):
     store = StoreModel('test')
     self.assertListEqual(
         store.items.all(), [],
         "The store's items length was not 0 even though no items were added."
     )
コード例 #30
0
    def test_create_store_items_empty(self):
        store = StoreModel('test_store')

        self.assertListEqual(
            store.items.all(), [],
            "the newly create store should have no items, but has.")