~panda-roux/MoonGem

ref: 95734358a15cb6229e3b2ddbe33a44527472cec4 MoonGem/test/test_definitions.py -rw-r--r-- 489 bytes
95734358 — panda-roux fixing a potential memory leak 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import ignition as ig
from ignition.response import BaseResponse

def fail(msg):
    return False, msg

def ok():
    return True, None

def exists(response: BaseResponse):
    if response.status == ig.RESPONSE_STATUSDETAIL_PERM_FAILURE_NOT_FOUND:
        return fail('Resource was not found')
    return ok()

def does_not_exist(response: BaseResponse):
    if response.status != ig.RESPONSE_STATUSDETAIL_PERM_FAILURE_NOT_FOUND:
        return fail('Resource was found')
    return ok()