コード例 #1
0
    def test_get_by_for_update(self):
        uuid = str(uuid4())
        t2 = Table2(id=1, user_uuid=uuid)
        save_to_database(t2)

        t2 = Table2.get_by('user_uuid', uuid, for_update=True)
        assert t2.id == 1
        t2.key2 = 10
        save_to_database(t2)
        t2 = Table2.get_by('user_uuid', uuid)
        assert t2.key2 == 10
コード例 #2
0
    def test_get_by(self):
        uuid = str(uuid4())
        t2 = Table2(id=1, user_uuid=uuid)
        save_to_database(t2)

        t2 = Table2.get_by('user_uuid', uuid)
        assert t2.id == 1
コード例 #3
0
    def test_get_by_deleted_contains(self):
        uuid = str(uuid4())
        t2 = Table2(id=1, user_uuid=uuid)
        save_to_database(t2)

        t2 = Table2.get_by('user_uuid', uuid, contains_deleted=True)
        assert t2.id == 1
コード例 #4
0
    def test_get_by_deleted(self):
        uuid = str(uuid4())
        t2 = Table2(id=1, user_uuid=uuid, deleted_at=arrow.get())
        save_to_database(t2)

        assert not Table2.get_by('user_uuid', uuid)
コード例 #5
0
 def test_get_by_empty(self):
     t2 = Table2(id=1, user_uuid=str(uuid4()))
     save_to_database(t2)
     assert not Table2.get_by('user_uuid', None)