コード例 #1
0
ファイル: test_model.py プロジェクト: opfront/python-sdk
    def test_save_without_id_doesnt_call_update(self):
        res = MockResource()

        m = Model(res, **ATTRIBUTE_SET)
        m.save()

        self.assertFalse(res.update.called)
コード例 #2
0
ファイル: test_model.py プロジェクト: opfront/python-sdk
    def test_save_without_id_calls_create(self):
        res = MockResource()

        m = Model(res, **ATTRIBUTE_SET)
        m.save()

        self.assertTrue(res.create.called)
コード例 #3
0
ファイル: test_model.py プロジェクト: opfront/python-sdk
    def test_save_with_id_when_exists_doesnt_call_create(self):
        res = MockResource(exists=True)

        m = Model(res, **ID_ATTRIBUTE_SET)
        m.save()

        self.assertFalse(res.create.called)
コード例 #4
0
ファイル: test_model.py プロジェクト: opfront/python-sdk
    def test_save_with_id_when_exists_calls_update(self):
        res = MockResource(exists=True)

        m = Model(res, **ID_ATTRIBUTE_SET)
        m.save()

        self.assertTrue(res.update.called)
コード例 #5
0
ファイル: test_model.py プロジェクト: opfront/python-sdk
    def test_save_with_id_when_not_exist_doesnt_call_update(self):
        res = MockResource()

        m = Model(res, **ID_ATTRIBUTE_SET)
        m.save()

        self.assertFalse(res.update.called)
コード例 #6
0
ファイル: test_model.py プロジェクト: opfront/python-sdk
    def test_save_with_id_when_not_exist_calls_create(self):
        res = MockResource()

        m = Model(res, **ID_ATTRIBUTE_SET)
        m.save()

        self.assertTrue(res.create.called)